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.
main.cpp
00001 #include "mbed.h" 00002 00003 #if !DEVICE_SLEEP 00004 #error [NOT_SUPPORTED] Sleep is not supported 00005 #endif 00006 00007 DigitalOut led1(LED1); 00008 DigitalOut led2(LED2); 00009 Timeout to1; 00010 Timeout to2; 00011 00012 void led1_on() { 00013 led1 = !led1; 00014 printf("led1\n\r"); 00015 fflush(stdout); 00016 } 00017 void led2_on() { 00018 led2 = !led2; 00019 printf("led2\n\r"); 00020 fflush(stdout); 00021 } 00022 00023 int main() { 00024 led1 = 0; 00025 led2 = 0; 00026 to1.attach_us(led1_on, 1000000); 00027 to2.attach_us(led2_on, 2000000); 00028 while (1) { 00029 printf("Entering sleep.\n"); 00030 sleep(); 00031 } 00032 }
Generated on Tue Jul 12 2022 11:59:06 by
1.7.2