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 myled1(LED1); 00004 DigitalOut myled2(LED2); 00005 DigitalOut myled3(LED3); 00006 DigitalOut myled4(LED4); 00007 00008 int main() 00009 { 00010 int ind = -1; 00011 bool direc = false; 00012 00013 while(1) { 00014 if (!direc) { 00015 ind++; 00016 if (ind > 3) { 00017 ind = 2; 00018 direc = true; 00019 } 00020 } else { 00021 ind--; 00022 if (ind < 0) { 00023 ind = 1; 00024 direc = false; 00025 } 00026 } 00027 00028 wait(0.4); 00029 00030 switch(ind) { 00031 case 0: 00032 myled1 = 1; 00033 myled2 = 0; 00034 myled3 = 0; 00035 myled4 = 0; 00036 //wait(0.4); 00037 break; 00038 case 1: 00039 myled1 = 0; 00040 myled2 = 1; 00041 myled3 = 0; 00042 myled4 = 0; 00043 //wait(0.4); 00044 break; 00045 case 2: 00046 myled1 = 0; 00047 myled2 = 0; 00048 myled3 = 1; 00049 myled4 = 0; 00050 //wait(0.4); 00051 break; 00052 case 3: 00053 myled1 = 0; 00054 myled2 = 0; 00055 myled3 = 0; 00056 myled4 = 1; 00057 //wait(0.4); 00058 break; 00059 } 00060 } 00061 }
Generated on Thu Jul 21 2022 03:18:51 by
1.7.2