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 led1(LED1); 00004 DigitalOut led2(LED2); 00005 DigitalOut led3(LED3); 00006 DigitalOut led4(LED4); 00007 00008 void ledout(int pat) { 00009 led1 = pat & 1; 00010 led2 = pat >> 1 & 1; 00011 led3 = pat >> 2 & 1; 00012 led4 = pat >> 3 & 1; 00013 } 00014 00015 int main() { 00016 int i; 00017 00018 while (1) { 00019 // move left 00020 for (i = 0x01; i != 0x8; i <<= 1) { 00021 ledout(i); 00022 wait(0.2); 00023 } 00024 // move right 00025 for (i = 0x08; i != 1; i >>= 1) { 00026 ledout(i); 00027 wait(0.2); 00028 } 00029 } 00030 }
Generated on Fri Jul 15 2022 02:12:01 by
1.7.2