Flash a LED two times in each 30 second, then the MCU goes to deepsleep mode.

Dependencies:   mbed WakeUp_STM32

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "WakeUp_STM32.h"           // see at https://os.mbed.com/users/kenjiArai/code/WakeUp_STM32/
00003 
00004 DigitalOut myled(LED1);
00005 
00006 int main() {
00007     uint32_t loop_count = 1;
00008     while(true) {
00009         // In run mode Imax = 44 mA
00010         myled = !myled;
00011         wait(0.25);
00012         if (++loop_count > 4) {
00013             WakeUp::standby_then_reset(30000);  // 30sec
00014             // In standby mode I = 3.7 uA
00015             while(true) {;} // never executing this line
00016         }
00017     }
00018 }