Data TTN to Thingspeak problem with Payload Decoder from Array
18 views (last 30 days)
I have a question regarding decoding in TTN specifically for Thingspeak.
The code in Arduino IDE for a MKR1310 is the following:
String sensorString = String(airTemperatureReading);// + "-" + String(altitudeReading)+ "-" + String(pressureReading)+ "-" + String(sensorValueRain);
sensorString.toCharArray(payload, sensorString.length() +1);
Here I tested just one sensor data, to make it easier to understand whats going on with the payload function in general. But I didn´t really manage with that. In TTN the decoding is ok, so I get with the decoder -just for TTN usage- 24 from Hex 323400. However, now I have to switch the decoder to Thingspeak readable data but with the following Decoder I just get 50 in field1, but 24°C is the right temperature.
function Decoder(bytes, port)
var tem = (bytes<<0) | bytes;
Test Byte Payload -> Complete uplink data
The complete Arduino Sketch is from here:
Thank you very much