statemachine

Dependencies:   mbed QEI HIDScope biquadFilter MODSERIAL FastPWM

Revision:
10:9101c7a4f219
Parent:
9:cdcf30051100
Child:
11:5171ac607099
Child:
16:0ff43ed4d259
--- a/main.cpp	Fri Sep 20 11:48:08 2019 +0000
+++ b/main.cpp	Fri Sep 20 12:07:59 2019 +0000
@@ -14,25 +14,29 @@
 
 FastPWM motor(D5);
 FastPWM led(PTA1);
-DigitalOut richting(D4);
+//DigitalOut richting(D4);
 
-int direction = 0;
-void flip() {
-    direction = !direction;
-}
+//int direction = 0;
+//void flip() {
+//    direction = !direction;
+//}
+
+//DigitalOut richting(D4);
+
+int pulses = 131;
+QEI wheel (D13,D12,NC,pulses);
 
-int main(){ 
-    printf("Controll with dial\n");    
-    
-    button2.rise(&flip);
-        
+int main()
+{ 
+    printf("Controll with dial\n");
         while(true)
-{
-            wait(0.1);
-            printf("motor speed is (%f)\n\r",pot.read()); 
-            wait(0.1);
-            richting.write(direction);
-            led.write(pot);
-            motor.write(pot);
+            {
+                wait(0.1);
+                printf("motor speeed is (%f)\n\r",pot.read());
+                wait(0.1);
+                led.write(pot);
+                motor.write(pot);
+                wait(0.1);
+                printf("pulse number is (%i)\n\r",wheel.getPulses());
             }
-}
+}
\ No newline at end of file