Daiki Kato / Mbed 2 deprecated Sleep_test_no_OS

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 
00003 InterruptIn button(USER_BUTTON0);
00004 DigitalOut led1(LED1);
00005 
00006 static void interrupt_button(void) {
00007     // do nothing
00008 }
00009 
00010 int main() {
00011     int test_cnt = 0;
00012 
00013     button.fall(&interrupt_button);
00014     button.rise(&interrupt_button);
00015 
00016     while (true) {
00017         // Transition to Sleep Mode
00018         __SEV();
00019         __WFE();
00020         __WFE();
00021         led1 = !led1;
00022         printf("%d\n", test_cnt++);
00023     }
00024 }