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.
Diff: main.cpp
- Revision:
- 0:5fb1beb99a3e
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Sat Aug 27 11:22:58 2016 +0000
@@ -0,0 +1,32 @@
+// 跑馬燈範例程式二
+#include "mbed.h"
+// 跑馬燈範例程式三
+DigitalOut myled0(D2);
+DigitalOut myled1(D3);
+DigitalOut myled2(D4);
+DigitalOut myled3(D5);
+DigitalOut myled4(D6);
+void port6bit_LED(int portin)
+{
+ myled0 = portin;
+ myled1 = portin>>1;
+ myled2 = portin>>2;
+myled3 = portin>>3;
+myled4 = portin>>4;
+}
+int main()
+{
+ int port = 0, portin, shift =0, max=5;
+while(1)
+ {
+ port = 0x01;
+ portin = port << shift;
+ port6bit_LED(portin);
+ shift++;
+if (shift == max) {
+ shift = 0;
+ }
+ wait_ms(100);
+}
+}
+