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 DigitalOut myled(LED1); 00004 InterruptIn event(USER_BUTTON); 00005 00006 Serial ser(USBTX, USBRX); 00007 00008 bool pressed = false; 00009 00010 void KeyPressed() 00011 { 00012 ser.printf("Key Pressed\r\n"); 00013 pressed = true; 00014 } 00015 00016 int main() { 00017 ser.baud(230400); 00018 ser.printf("Hello, World\r\n"); 00019 event.fall(&KeyPressed); 00020 00021 while(1) { 00022 myled = 1; 00023 wait(0.2); 00024 myled = 0; 00025 wait(1.0); 00026 if (pressed) { 00027 deepsleep(); 00028 pressed = false; 00029 } 00030 } 00031 }
Generated on Sun Jul 17 2022 17:37:07 by
1.7.2