sadasd

Dependencies:   mbed

Fork of Nucleo_read_button by joseph chen

Files at this revision

API Documentation at this revision

Comitter:
digo1234
Date:
Tue Apr 24 18:39:05 2018 +0000
Parent:
1:52e576abcb8a
Commit message:
teste bot?o

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 52e576abcb8a -r 5d81a684944c main.cpp
--- a/main.cpp	Thu May 05 02:43:46 2016 +0000
+++ b/main.cpp	Tue Apr 24 18:39:05 2018 +0000
@@ -1,16 +1,19 @@
 #include "mbed.h"
  
-DigitalIn mybutton(PC_13);
-DigitalOut myled(LED1);
- 
+DigitalIn mybutton(D2);
+int count = 0;
+int previous =1;
+
 int main() {
   
-  
+
   while(1) {
-    if (mybutton == 0) { // Button is pressed
-      myled = !myled; // Toggle the LED state
-      wait(0.2); // 200 ms
+    if (mybutton == 0 and previous == 1) { // Button is pressed
+      previous = 0; 
+      count = count + 1;
+        if (mybutton ==1){
+            previous =1;  
     }
   }
 }
- 
\ No newline at end of file
+ }
\ No newline at end of file