Werkend aansturingsscript voor 2 motoren, incl werkende program switch. Motoren oscilleren nog iets. Vuur mechanisme ontbreekt nog.

Dependencies:   HIDScope MODSERIAL QEI biquadFilter mbed

Fork of frdm_Motor_V2_2 by Margreeth de Breij

Revision:
5:455773cf460b
Parent:
4:0d4aff8b57b3
Child:
6:3af4a77c9935
Child:
7:67b50d4fb03c
diff -r 0d4aff8b57b3 -r 455773cf460b main.cpp
--- a/main.cpp	Mon Sep 28 13:43:14 2015 +0000
+++ b/main.cpp	Tue Sep 29 11:54:47 2015 +0000
@@ -10,7 +10,7 @@
 DigitalIn button1(SW3);
 DigitalIn EncoderA(D3);
 DigitalIn EncoderB(D2);
-QEI Encoder(D3, D2, NC, 32);
+QEI Encoder(D3, D2, NC, 128);
 HIDScope scope(3);
 Ticker ScopeTime;
 float Aantal_Degs;
@@ -25,7 +25,7 @@
     scope.set(0, motor2direction.read());
     scope.set(1, motor2speed.read());
     scope.set(2, Aantal_Degs);
-    Aantal_Degs = Encoder.getPulses()*360/31/131;
+    Aantal_Degs = Encoder.getPulses()*360/128/131;
 
     scope.send();
     
@@ -63,7 +63,7 @@
                     }
                     else
                     {
-                    motor2direction = 1;
+                        motor2direction = 1;
                     }
 
                 }