/ lorawan_sensing_network / ttn_decoder_bme280.js
ttn_decoder_bme280.js
1 // TinyLoRa - BME280 and Feather ID Decoder 2 function Decoder(bytes, port) { 3 var decoded = {}; 4 5 // Decode bytes to int 6 var celciusInt = (bytes[1] << 8) | bytes[2]; 7 var humidInt = (bytes[3] << 8) | bytes[4]; 8 9 // Decode Feather ID 10 decoded.featherID = bytes[0] 11 // Decode int to float 12 decoded.celcius = celciusInt / 100; 13 decoded.humid = humidInt / 100; 14 15 return decoded; 16 }