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 /*Program Example 3.1: Demonstrates use of while loops. No external connection required 00002 */ 00003 #include "mbed.h" 00004 DigitalOut myled(LED1); 00005 DigitalOut yourled(LED4); 00006 00007 int main() 00008 { 00009 char i=0; //declare variable i, and set to 0 00010 while(1) { //start endless loop 00011 while(i<10) { //start first conditional while loop 00012 myled = 1; 00013 wait(0.2); 00014 myled = 0; 00015 wait(0.2); 00016 i = i+1; //increment i 00017 } //end of first conditional while loop 00018 while(i>0) { //start second conditional loop 00019 yourled = 1; 00020 wait(0.2); 00021 yourled = 0; 00022 wait(0.2); 00023 i = i-1; 00024 } 00025 } //end infinite loop block 00026 } //end of main 00027
Generated on Fri Jul 15 2022 03:02:03 by
1.7.2