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 counter; 00009 00010 void countup() { 00011 00012 for (counter = 1; counter < 9; counter = counter << 1) { 00013 myled1 = counter & 1; 00014 myled2 = (counter >> 1) & 1; 00015 myled3 = (counter >> 2) & 1; 00016 myled4 = (counter >> 3) & 1; 00017 wait(0.1); 00018 } 00019 } 00020 00021 void countdown() { 00022 00023 for (counter = 8; counter > 1; counter = counter >> 1) { 00024 myled1 = counter & 1; 00025 myled2 = (counter >> 1) & 1; 00026 myled3 = (counter >> 2) & 1; 00027 myled4 = (counter >> 3) & 1; 00028 wait(0.1); 00029 } 00030 } 00031 00032 int main() { 00033 while (1) { 00034 countup(); 00035 countdown(); 00036 } 00037 } 00038 00039 00040 00041 00042 00043 00044 00045
Generated on Fri Jul 22 2022 15:04:13 by
1.7.2