Hello community!
I have been trying to create a sketch using the OneWire.
I was using a char buffer to hold the address value that is returned from the OneWire library (the library needs a byte array, I had to convert it into a char *)
I had some sort of issue, because the first time my Photon would boot up, it would correctly list out each address, but once I looped back around, it would reuse some of the address names (they were the key in Particle.publish), but the Temp value would get correctly reused/replaced.
In trying to diagnose the problem, I was looking at the example at Tutorial: Getting Started with Spark.publish()
I added it into my example, and I had the ‘uptime’ buffer being used for the address data as well.
This caused me to still see the particle.publish results on my dashboard, but it would post, and then my particle would switch to flashing cyan, green, and then ‘SOS’ with the red light (three short pulses of red, three long pulses, three short) a pause, then a single flash of red. Then the lights would replay.
I was unable to reflash from the web editor, and I ended up manually reseting the Photon to be able to add any other sketches to it.
Is there a way that I can make my sketch public to the community, or should I just link it to a github gist with my code in it?
It’s been a while since I’ve done C strings, and haven’t been able to find a good example.
The example that is provided with the OneWire library uses Serial.print one byte at a time from the byte array that represents the address. I didn’t see a good example of how to translate that into a c string to use with the Particle.publish interface.
It would be good if there were a few examples given using a common buffer, as I have seen it mentioned that constantly creating new String objects to use with Particle.publish will eventually cause stability issues due to heap fragmentation.
Thanks in advance for your assistance.