Button

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
muminhadzic
Date:
Thu Dec 19 18:28:18 2019 +0000
Commit message:
..

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 f38709642054 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Dec 19 18:28:18 2019 +0000
@@ -0,0 +1,39 @@
+#include "mbed.h"
+
+BusOut lb(D2,D3,D6,D9,D11,D12,A6,D13);
+DigitalIn T1(A1);
+int CheckButton();
+void OneRunLightStepR2();
+int prevButtonState=0;
+void main()
+
+{
+    lb=1;
+    while(1){
+        if (CheckButton()==1)
+        
+        OneRunLightStepR2();
+        
+        }
+    }
+int CheckButton()
+{
+    int ret;
+    if(prevButtonState== 1 && T1.read()== 0)
+    ret=1;
+    else
+    ret=0;
+    prevButtonState = T1.read();
+    return ret;
+    }
+
+
+void OneRunLightStepR2()
+    {
+        if (lb==0)
+        lb = 1;
+        else
+        lb = lb<<1;
+        
+        }
+
diff -r 000000000000 -r f38709642054 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Dec 19 18:28:18 2019 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400
\ No newline at end of file