Best way to change a DK variable from a Gateway



I have a DK connected to a Gateway and sending data to it. The Gateway has a Photon running and I can see/read the data being sent. I am using the following code on the Gateway:

float ammo;
union cvt {
float val;
unsigned char b[4];
} x;
void handle_custom_data(uint8_t *data, uint16_t length) {
for (int i=0; i <= 3; i++){
Particle.publish(“Bluz Custom Data”, (String(ammo)));

What is the best way to change a variable in a sketch running on that DK?

I would like to be able to write a variable (double) in a Gateway function which gets communicated to a connected DK so a global variable on the DK can be changed while a sketch is running.

Is there example code showing how to do this?

Thanks in advance.