![](/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:
- 1:36e336869699
- Parent:
- 0:3ec6a7645098
- Child:
- 2:866a72c3c3bf
diff -r 3ec6a7645098 -r 36e336869699 main.cpp --- a/main.cpp Sun Jul 03 15:45:03 2016 +0000 +++ b/main.cpp Sun Jul 03 16:00:14 2016 +0000 @@ -7,9 +7,12 @@ #include "mbed.h" #include <math.h> + #include "BME280.h" -// UDK Specific +// mDot UDK Specific +// MDot Pinout: https://developer.mbed.org/platforms/MTS-mDot-F411/#pinout-diagram // Uncomment this line if using a full sized UDK2.0 instead of a Micro UDK + #define UDK2 1 #ifdef UDK2 DigitalOut led(LED1); @@ -17,6 +20,12 @@ DigitalOut led(XBEE_RSSI); #endif +//BME280 sensor(I2C_SDA, I2C_SCL) +// MDot UDK - I2C_SDA and I2C_SCL connected to PC_9/PA_* +BME280 b280(PC_9, PA_8); + + + // Globals Ticker tick; @@ -24,6 +33,7 @@ void endLessTestLoop(); void setUpLEDBlink(); void blink(); +void readandprintBME280(); /***************************************************** @@ -33,6 +43,7 @@ // Simple Test Functions, "Hello World on UDK setUpLEDBlink(); + endLessTestLoop(); return 0; @@ -41,14 +52,19 @@ +/***************************************************** + * Sensor Functions + ****************************************************/ - +void readandprintBME280() { + printf("%2.2f degC, %04.2f hPa, %2.2f %%\n", b280.getTemperature(), b280.getPressure(), b280.getHumidity()); +} /***************************************************** -* FUNCTIONS for Simple Testing -*****************************************************/ + * FUNCTIONS for Simple Testing + ****************************************************/ void setUpLEDBlink(){ // configure the Ticker to blink the LED on 500ms interval @@ -57,8 +73,10 @@ void endLessTestLoop() { while(true) { - printf("Hello world!\r\n"); - wait(3); + // printf("Hello world!\r\n"); + printf("BME280 Sensor: \n"); + readandprintBME280(); + wait(5); } }