Quantcast
Channel: The Things Network - Latest posts
Viewing all articles
Browse latest Browse all 117005

Problem in sending negative values in the payload

$
0
0

I’ve a LoRaWAN end-node (Feather M0 LoRa) sending data to the gateway (IMST+Pi3). I’m using MCCI LoRaWAN LMiC library to send solar battery current data. The code I’m using is an adapted version of https://github.com/mcci-catena/arduino-lmic/blob/master/examples/ttn-otaa-feather-us915-dht22/ttn-otaa-feather-us915-dht22.ino to suit to my application.

The battery current is positive during charging time and negative during discharging time. I could see battery charging current properly in my application server (i.e., positive values), however when it comes to discharging current, I’m seeing the values at +645 in the application server instead of negative values.

I carefully looked at my code and I suspect if the following line could be the problem.
LMIC_setTxData2(1, (uint8_t*)payload, sizeof(payload), 0);

As such uint8_t has a range of 0 to 255, and it cannot take negative values. Am I right here? How do I overcome this error?


Viewing all articles
Browse latest Browse all 117005

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>