Sensor
// This corresponds to the Quick Start sketch in The Things Network arduino library // See https://github.com/TheThingsNetwork/arduino-device-lib/blob/master/examples/QuickStart/QuickStart.ino var LED_STATES = ['off', 'on'] function decodeUplink(input) { var data = {}; data.ledState = LED_STATES[input.bytes[0]]; return { data: data, }; } function encodeDownlink(input) { var i = LED_STATES.indexOf(input.data.ledState); if (i === -1) { return { errors: ['unknown led state'], }; } return { bytes: [i], fPort: 1, }; } function decodeDownlink(input) { return { data: { ledState: LED_STATES[input.bytes[0]] } } }
This codec is sourced from The Things Network. All rights belong to The Things Network.
This codec is licensed under the GNU General Public License v3 (GPL v3). Modifications, if any, are clearly marked. You are free to use, modify, and distribute the codec under the terms of GPL v3.