![](/media/cache/profiles/2dd26bee3d25f4e22c3db125e415203a.jpg.50x50_q85.jpg)
This program connects to the The Things Network backend in OTAA Mode. It logs sensor values from a BME 280 to the backend. Tried adding support for Grove GPS using SerialGPS library but it is not working - conflicting with mbed-rtos, so it commented. Deep Sleep for mDot implemented BUT avoiding reprogramming of the mDot config is NOT working.
Dependencies: BME280 SerialGPS libmDot mbed-rtos mbed
Diff: main.cpp
- Revision:
- 0:3ec6a7645098
- Child:
- 1:36e336869699
diff -r 000000000000 -r 3ec6a7645098 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sun Jul 03 15:45:03 2016 +0000 @@ -0,0 +1,68 @@ +/****************************************************** + * A Program to interface the Grove Base Shielf V2 + * to the mDot UDK. + * Additionally sample code to compress the data + * for use with LPWANs such as LoRa +*****************************************************/ + + #include "mbed.h" + #include <math.h> + +// UDK Specific +// Uncomment this line if using a full sized UDK2.0 instead of a Micro UDK +#define UDK2 1 +#ifdef UDK2 +DigitalOut led(LED1); +#else +DigitalOut led(XBEE_RSSI); +#endif + +// Globals +Ticker tick; + +// Function Declarations +void endLessTestLoop(); +void setUpLEDBlink(); +void blink(); + + +/***************************************************** +* MAIN +*****************************************************/ +int main(){ + + // Simple Test Functions, "Hello World on UDK + setUpLEDBlink(); + endLessTestLoop(); + + return 0; +} + + + + + + + + + +/***************************************************** +* FUNCTIONS for Simple Testing +*****************************************************/ + +void setUpLEDBlink(){ + // configure the Ticker to blink the LED on 500ms interval + tick.attach(&blink, 0.5); +} + +void endLessTestLoop() { + while(true) { + printf("Hello world!\r\n"); + wait(3); + } +} + +// Callback function to change LED state +void blink() { + led = !led; +} \ No newline at end of file