Hi,
i am using Dragino with Arduino Uno, OTAA. I have Problem with negative numbers. Positive numbers works fine. Its a basic mistake for sure, but i just cant see it.
Arduino code:
temperature=-10;
static int8_t payloadA[4];
mydata[0] = highByte(ID);
mydata[1] = lowByte(ID);
mydata[2] = highByte(temperature);
mydata[3] = lowByte(temperature);
TNN Code:
function Decoder(bytes) {
var decoded_tsbid = (bytes[0]<<8) | bytes[1] ;
var temp_operator = (bytes[2]<<24>>16) ;
var temp_value = (bytes[3]) ;
var temp = temp_operator + temp_value ;
return {
Id: decoded_tsbid ,
Temperature: temp ,
};
}
Output:
I already read the article: Decrypting messages for dummies
but that didnt solve my problem, maybe you can you help me finde the solution