/ TheThingsNetwork_Feather / tinylora_dht22_decoder.js
tinylora_dht22_decoder.js
1 // TinyLoRa - DHT22 Decoder 2 function Decoder(bytes, port) { 3 var decoded = {}; 4 5 // Decode bytes to int 6 var celciusInt = (bytes[0] << 8) | bytes[1]; 7 var humidInt = (bytes[2] << 8) | bytes[3]; 8 9 // Decode int to float 10 decoded.celcius = celciusInt / 100; 11 decoded.humid = humidInt / 100; 12 13 return decoded; 14 }