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
main.cpp
- Committer:
- AshuJoshi
- Date:
- 2016-07-03
- Revision:
- 0:3ec6a7645098
- Child:
- 1:36e336869699
File content as of revision 0:3ec6a7645098:
/******************************************************
* 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;
}