Esempio per carlo

Dependencies:   mbed

Revision:
0:d388a00e3820
Child:
1:2ca9dd78e30c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Jan 25 10:30:24 2018 +0000
@@ -0,0 +1,31 @@
+#include "mbed.h"
+#include <stdlib.h>
+
+
+InterruptIn encoder(USER_BUTTON); //FACCIO FINTA CHE L'encoder sia il bottone attento ne servono due uno per ruota
+
+long int count1;
+int scattiPerGiro = 3;
+ 
+void ruota1() {
+    count1++;
+}
+
+
+float numeroGiri(){
+   return count1 / scattiPerGiro;
+}
+
+
+
+
+
+int main()
+{
+    encoder.rise(&ruota1);
+
+    while (1) {
+        led = !led;
+        wait(delay);
+    }
+}