![](/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:
- 4:97f9ad3f2566
- Parent:
- 3:5c2bcba214b5
- Child:
- 5:4bc6ba66f28e
diff -r 5c2bcba214b5 -r 97f9ad3f2566 main.cpp --- a/main.cpp Mon Jul 04 22:42:27 2016 +0000 +++ b/main.cpp Thu Jul 07 00:07:45 2016 +0000 @@ -12,6 +12,7 @@ #include "MTSLog.h" #include "MTSText.h" #include "BME280.h" + using namespace mts; @@ -34,7 +35,6 @@ BME280 b280(PC_9, PA_8); - // Globals Ticker tick; mDot* dot; @@ -48,6 +48,7 @@ void mDotConfig(); void mDotGotoDeepSleep(int seconds); void mDotConfigPrint(); +void initSerialGPS(); @@ -60,7 +61,7 @@ setUpLEDBlink(); mDotConfig(); mDotConfigPrint(); - wait(15); + endLessTestLoop(); return 0; @@ -86,7 +87,8 @@ uint32_t sleep_time = MAX((dot->getNextTxMs() / 1000), seconds); logInfo("going to sleep for %d seconds", sleep_time); // go to sleep and wake up automatically sleep_time seconds later - dot->sleep(sleep_time, mDot::RTC_ALARM, false); + //dot->sleep(sleep_time, mDot::RTC_ALARM, false); + dot->sleep(sleep_time, mDot::RTC_ALARM); } @@ -161,6 +163,11 @@ float pressure; float humidity; char string_buffer[64]; + time_t secs; + + secs = time(NULL); + printf("Seconds since January 1, 1970: %d\n", secs); + printf("Time as a basic string = %s", ctime(&secs)); // Temperature temperature = b280.getTemperature(); @@ -195,7 +202,8 @@ printf("BME280 Sensor: \n"); readandprintBME280(); - mDotGotoDeepSleep(10); + mDotGotoDeepSleep(60); + //wait(5); } } @@ -203,4 +211,6 @@ // Callback function to change LED state void blink() { led = !led; -} \ No newline at end of file +} + + \ No newline at end of file