Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of Nucleo_sleep by
main.cpp
00001 #include "mbed.h" 00002 00003 InterruptIn event(USER_BUTTON); 00004 DigitalOut myled(LED1); 00005 00006 int go_to_sleep = 0; 00007 00008 void pressed() 00009 { 00010 printf("Button pressed\n"); 00011 go_to_sleep = !go_to_sleep; 00012 } 00013 00014 int main() 00015 { 00016 int i = 0; 00017 00018 event.fall(&pressed); 00019 00020 while (1) { 00021 if (go_to_sleep) { 00022 myled = 1; 00023 printf("%d: Entering sleep (press user button to resume)\n", i); 00024 sleep(); 00025 //deepsleep(); 00026 //wait(0.1); 00027 } else { 00028 printf("%d: Running\n", i); 00029 myled = !myled; 00030 wait(1.0); 00031 } 00032 i++; 00033 } 00034 }
Generated on Tue Aug 2 2022 21:53:49 by
1.7.2
