increment

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
HisyamSulaiman
Date:
Thu May 24 02:30:46 2018 +0000
Commit message:
increment;

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r c1fb90b1352b main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu May 24 02:30:46 2018 +0000
@@ -0,0 +1,32 @@
+#include "mbed.h"
+DigitalIn button(D4);
+BusOut seg(D7,D8,D9,D10,D11,D12,D13);
+
+char SegConvert(char SegValue);
+
+int main() {
+    while(1) {
+        for (char i=0;i<10; button==1&&i++) 
+        {
+            seg=SegConvert(i);
+            wait(1);
+            }
+            }
+            }
+            
+char SegConvert(char SegValue){
+        char SegByte=0x00;
+        switch(SegValue) {
+       case 0 : SegByte = 16;break;
+       case 1 : SegByte = 0;break;
+       case 2 : SegByte = 120;break;
+       case 3 : SegByte = 2;break;
+       case 4 : SegByte = 18;break;
+       case 5 : SegByte = 25;break;
+       case 6 : SegByte = 48;break;
+       case 7 : SegByte = 36;break;
+       case 8 : SegByte = 121;break;
+       case 9 : SegByte = 64;break;
+    }
+    return SegByte;
+}
\ No newline at end of file
diff -r 000000000000 -r c1fb90b1352b mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu May 24 02:30:46 2018 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/aa5281ff4a02
\ No newline at end of file