Brendan Kelly
/
mDot_helloworld_bk_sleep
An attempt to sleep an mDot
Fork of mDot_helloworld_bk by
Diff: main.cpp
- Revision:
- 4:0c96c67d914b
- Parent:
- 3:706cdd7ce1b2
- Child:
- 5:4f89c0fcbe59
--- a/main.cpp Wed Aug 09 00:08:08 2017 +0000 +++ b/main.cpp Wed Aug 09 02:27:51 2017 +0000 @@ -4,7 +4,9 @@ #include "ChannelPlans.h" #include "MTSLog.h" + int main() { + int count = 0; // use AU915 plan lora::ChannelPlan* plan = new lora::ChannelPlan_AU915(); assert(plan); @@ -12,10 +14,15 @@ mDot* dot = mDot::getInstance(plan); assert(dot); + //it will keep looping and sleeping in this loop - thread continues from sleep + while (true) { + count++; // print the message - logInfo("Hello world! I am an mDot"); - - // go to sleep and wake up automatically sleep_time seconds later + logInfo("Hello world! I am an mDot counting %d", count); + // go to sleep and wake up automatically sleep_time seconds later uint32_t sleep_time = 5; - dot->sleep(sleep_time, mDot::RTC_ALARM); + //false is "don't deep sleep - mDot doesn't do that + dot->sleep(sleep_time, mDot::RTC_ALARM, false); + logInfo("\r\n"); + } } \ No newline at end of file