Added Decoder JS Code
This commit is contained in:
parent
2e526f5cd7
commit
2a0516ec83
|
@ -3,4 +3,22 @@
|
|||
Example Sensor Node Firmware with a BMP/E280 Sensor.
|
||||
Please Change the Values in src/secconfig.h to your Keys from https://console.thethingsnetwork.org. Device has to be set to ABP Mode.
|
||||
|
||||
Project was created using PlatformIO Atmel-AVR Framework
|
||||
Project was created using PlatformIO Atmel-AVR Framework
|
||||
|
||||
## Decoder for the TTN Application
|
||||
|
||||
```
|
||||
function Decoder(bytes, port) {
|
||||
var decoded = {};
|
||||
decoded.t = (bytes[0]) | (bytes[1] << 8 ) | (bytes[2] << 16 ) | (bytes[3] << 24)
|
||||
decoded.t = decoded.t / 100
|
||||
decoded.p = (bytes[4]) | (bytes[5] << 8 ) | (bytes[6] << 16 ) | (bytes[7] << 24)
|
||||
decoded.p = decoded.p / 100
|
||||
decoded.h = (bytes[8]) | (bytes[9] << 8 ) | (bytes[10] << 16 ) | (bytes[11] << 24)
|
||||
decoded.h = decoded.h / 100
|
||||
decoded.v = (bytes[12]) | (bytes[13] << 8 ) | (bytes[14] << 16 ) | (bytes[15] << 24)
|
||||
decoded.v = decoded.v / 1000
|
||||
|
||||
return decoded;
|
||||
}
|
||||
```
|
Loading…
Reference in a new issue