I have a temp/humidity sensor, I am reading the values using
float humidity = dht.getHumidity();
float temperature = dht.getTempCelcius();
I have tried pretty much all I can think of to publish these variables using particle.variable but I am either getting no value or garbage. Can someone assist on what needs to be done to achieve this starting with the definition of the variable in the particle.variable function please? I’d like to be able to see the humidity/temperature in 2 decimal format.
Thanks, worked like a charm, after using the sprintf conversion you suggested I used Particle.variable(“temperature”, eventData); and displayed as a string. Thanks.
To access with Particle.variable(), you should be able to declare it as a double instead of as a float, and not need to do any conversion at all! It’s Particle.publish() that needs it to be a String. Particle.variable() supports int, double and String data types.
so that threw me off. I’d like to update the example and change those to double as I did in my version of the example. kinda silly but at least it would be something I could contribute to particle.
Dave Carlson