Is anyone aware that this example from the documentation works on Core but not on Photon?
// Open a serial terminal and see the device name printed out
void handler(const char *topic, const char *data) {
Serial.println("received " + String(topic) + ": " + String(data));
}
void setup() {
Serial.begin(115200);
for(int i=0;i<5;i++) {
Serial.println("waiting... " + String(5 - i));
delay(1000);
}
Spark.subscribe("spark/", handler);
Spark.publish("spark/device/name");
Spark.publish("spark/device/random");
Spark.publish("spark/device/ip");
}
Is this a cloud or firmware issue?
bko
July 27, 2015, 7:39pm
2
Hi @steelydev
We have had problems in the past like this for which the work-around is adding a delay of say 2 seconds between each Spark.publish() to allow for the round-trip to the cloud and back.
Can you try that and report back?
1 Like
Just tried that. No luck.
Also added in call to loop() just in case:
Spark.subscribe("spark/", handler);
delay(5000);
Spark.publish("spark/device/name");
delay(5000);
Spark.publish("spark/device/random");
delay(5000);
Spark.publish("spark/device/ip");
delay(5000);
}
void loop() {
Serial.println("Done");
}
@steelydev , the issue has been identified and fixed but waiting for an update to the
1 Like
Thanks. I searched for spark/device/ and spark/device/name. But Iām not sure I would have understood the description of the issue, anyway.
Thank you, Particle, device/name seems to work now!
1 Like