decrement

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
HisyamSulaiman
Date:
Thu May 24 02:31:16 2018 +0000
Commit message:
decrement

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 78c6e2cff91a main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu May 24 02:31:16 2018 +0000
@@ -0,0 +1,57 @@
+#include "mbed.h"
+DigitalIn button (D4);
+
+char i;
+BusOut seg1(D13,D12,D11,D10,D9,D8,D7);
+ char segConvert(char SegValue); 
+ int main (){
+  i=0;
+  while(1)  {
+        
+        
+        if(button==1)
+        {
+          i=i+1   ;       
+          seg1=segConvert(i);
+          wait(1);
+          while(button==1)
+          {
+              seg1=segConvert(i);
+              }
+          if (i==10)
+          {
+              i=0;
+              seg1=segConvert(i);
+              }
+         else
+           {
+               i=0;
+               seg1=segConvert(i);
+               
+               }
+          
+          
+          
+        
+        }
+        }
+        }
+        char segConvert(char SegValue)
+        {
+        char SegByte=0x00;
+        switch (SegValue)
+        {
+        case 0 : SegByte = 0x1;break;
+        case 1 : SegByte = 0x4f;break;
+        case 2 : SegByte = 0x12;break;
+        case 3 : SegByte = 0x6;break;
+        case 4 : SegByte = 0x4c;break;
+        case 5 : SegByte = 0x24;break;
+        case 6 : SegByte = 0x20;break;
+        case 7 : SegByte = 0xf;break;
+        case 8 : SegByte = 0x0;break;
+        case 9 : SegByte = 0xc;break;       
+       }
+       return SegByte;
+    }
+      
\ No newline at end of file
diff -r 000000000000 -r 78c6e2cff91a mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu May 24 02:31:16 2018 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/aa5281ff4a02
\ No newline at end of file