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 DigitalIn mybutton(USER_BUTTON); 00004 DigitalOut myled(LED1); 00005 00006 int main() { 00007 while(1) { 00008 if (mybutton == 0) { // Button is pressed 00009 myled = !myled; // Toggle the LED state 00010 wait(0.1); // 100 ms 00011 } 00012 else { 00013 myled = 1; // LED is ON 00014 wait(0.2); // 200 ms 00015 myled = 0; // LED is OFF 00016 wait(1.0); // 1 sec 00017 } 00018 } 00019 } 00020
Generated on Mon Jul 18 2022 22:16:48 by
1.7.2