How to validate that Particle.subscribe data is received

I wanted to know a simple way to validate that the data from a particle.subscribe call from a 2nd Photon is being received. I have set up the 1st Photon to monitor temperature & humidity, send the data to the Particle Cloud and Ubidots using particle.publish. In the CLI, I can subscribe and view the data as it is published by the 1st Photon, so I know the event is publishing. Is there a simple way to verify that the 2nd Photon is receiving the data from the subscription? The simple code I’ve implemented on the 2nd Photon is:

int i = 0;

void myHandler(const char *event, const char *data)
Serial.print(", data: ");
if (data)

void setup()
  Particle.subscribe("AbsoulteHumidity_Photon1", myHandler, MY_DEVICES);

The publish code is:

//Publish to Particle
    Particle.publish("AbsoluteHumidity_Photon1", String(humidity_a), 60, PRIVATE);

There is no output from the serial monitor, which leads me to believe that the subscription is not functioning properly. Any direction is welcome. Thanks!

You’ve got a typo on your subscription

1 Like

Grrrr. Thank you! I’ve been trying different combinations over the past 36 hours and I guess I needed another pair of eyes.

1 Like

I can start a different thread so the topic is relevant to the question, how do I pass the “data” reading so it can be utilized later in the loop routine? I’m attempting to take a humidity reading and based on the the value, turn a switch on (or leave off).

You could use x = atoi(data); (or whatever fits your data type) where x is a global integer (or respective other type).