Official Losant + Particle Setup Tutorial

Try this.

#1 Create a Global Variable by placing this line of code above Setup().

This creates the bucket to hold the data we put into the publishStateString bucket. It's large enough to hold all the data a Webhook can hold in a single Publish Event which is 255 bytes.

char publishStateString[256]; //This is used to hold the device status info we format and Particle Publish to Losant.

#2. Add this new publish code to your sketch.

snprintf(publishStateString, sizeof(publishStateString), "%.2f:",F );
Particle.publish("EF", publishStateString, 60, PRIVATE, NO_ACK);

#3. Make sure this is considered a Number data type in Losant.

#4. Make sure you follow what I did in the Function & Device state notes I show above.

#5. This thread should help you understand how snprintf works for formatting the data your sending to Losant to have the semi-colon in between every variable we send.

2 Likes