test _oliver

Dependencies:   libmDot-mbed5

Committer:
oliverfchen
Date:
Thu Jan 17 00:26:38 2019 +0000
Revision:
5:9cece686c709
Parent:
4:0fd5e5e121ea
oliver test code

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Jan Jongboom 1:b604a2d6c54d 1 # Two way data using Multitech mDot
janjongboom 0:20fbd6f66b11 2
Jan Jongboom 4:0fd5e5e121ea 3 Demonstrates two-way data over LoRaWAN using Multitech mDot.
janjongboom 0:20fbd6f66b11 4
Jan Jongboom 1:b604a2d6c54d 5 1. Triggers transmission when D6 goes high - this is the special wake-up pin on the mDot. Short D6 to test quickly.
Jan Jongboom 1:b604a2d6c54d 6 2. The RX window is used to toggle D2. If 0x00 is received the pin goes high, if 0x01 is received the pin goes low (as the LEDs are inverted on the break-out board).
janjongboom 0:20fbd6f66b11 7
Jan Jongboom 1:b604a2d6c54d 8 ## Using this software with mbed Device Connector
janjongboom 0:20fbd6f66b11 9
Jan Jongboom 1:b604a2d6c54d 10 1. Connect your gateway to LORIOT EU1.
Jan Jongboom 1:b604a2d6c54d 11 2. Go to http://apm-lora-eu2.cloudapp.net:5101 and click on 'Create new device'.
Jan Jongboom 1:b604a2d6c54d 12 3. Paste in a security.h file from your Connector account.
Jan Jongboom 1:b604a2d6c54d 13 4. Copy the keys over to ``main.cpp``.
Jan Jongboom 1:b604a2d6c54d 14 5. Compile and flash, and verify that messages arrive.
Jan Jongboom 1:b604a2d6c54d 15 6. Configure the device like this:
Jan Jongboom 1:b604a2d6c54d 16 * Resources:
Jan Jongboom 1:b604a2d6c54d 17 ```json
Jan Jongboom 1:b604a2d6c54d 18 {
Jan Jongboom 1:b604a2d6c54d 19 "button/0/clicks": {
Jan Jongboom 1:b604a2d6c54d 20 "mode": "r",
Jan Jongboom 1:b604a2d6c54d 21 "defaultValue": "0"
Jan Jongboom 1:b604a2d6c54d 22 },
Jan Jongboom 1:b604a2d6c54d 23 "led/0/value": {
Jan Jongboom 1:b604a2d6c54d 24 "mode": "w"
Jan Jongboom 1:b604a2d6c54d 25 }
janjongboom 0:20fbd6f66b11 26 }
Jan Jongboom 1:b604a2d6c54d 27 ```
Jan Jongboom 1:b604a2d6c54d 28 * Process Data:
Jan Jongboom 1:b604a2d6c54d 29 ```js
Jan Jongboom 1:b604a2d6c54d 30 function (bytes) {
Jan Jongboom 1:b604a2d6c54d 31 return {
Jan Jongboom 1:b604a2d6c54d 32 "button/0/clicks": (bytes[0] << 8) + bytes[1]
Jan Jongboom 1:b604a2d6c54d 33 };
janjongboom 0:20fbd6f66b11 34 }
Jan Jongboom 1:b604a2d6c54d 35 ```
Jan Jongboom 1:b604a2d6c54d 36 * Write Data:
Jan Jongboom 1:b604a2d6c54d 37 ```js
Jan Jongboom 1:b604a2d6c54d 38 {
Jan Jongboom 1:b604a2d6c54d 39 "led/0/value": function (v) {
Jan Jongboom 3:ac5101a47080 40 return { port: 2, data: [ Number(v) ? 0x1 : 0x0 ] };
Jan Jongboom 1:b604a2d6c54d 41 }
Jan Jongboom 1:b604a2d6c54d 42 }
Jan Jongboom 1:b604a2d6c54d 43 ```
Jan Jongboom 1:b604a2d6c54d 44 7. Click 'Save'.