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 // 跑馬燈範例程式二 00002 #include "mbed.h" 00003 // 跑馬燈範例程式三 00004 DigitalOut myled0(D2); 00005 DigitalOut myled1(D3); 00006 DigitalOut myled2(D4); 00007 DigitalOut myled3(D5); 00008 DigitalOut myled4(D6); 00009 void port6bit_LED(int portin) 00010 { 00011 myled0 = portin; 00012 myled1 = portin>>1; 00013 myled2 = portin>>2; 00014 myled3 = portin>>3; 00015 myled4 = portin>>4; 00016 } 00017 int main() 00018 { 00019 int port = 0, portin, shift =0, max=5; 00020 while(1) 00021 { 00022 port = 0x01; 00023 portin = port << shift; 00024 port6bit_LED(portin); 00025 shift++; 00026 if (shift == max) { 00027 shift = 0; 00028 } 00029 wait_ms(100); 00030 } 00031 } 00032
Generated on Fri Jul 15 2022 03:18:45 by
1.7.2