Definitieve motorscript in aanbouw

Dependencies:   HIDScope MODSERIAL QEI biquadFilter mbed

Fork of frdm_Motor_V2_2 by Robert Schulte

Revision:
1:48aba8d5610a
Parent:
0:284ed397e046
Child:
2:099da0fc31b6
--- a/main.cpp	Mon Sep 28 10:25:52 2015 +0000
+++ b/main.cpp	Mon Sep 28 10:49:56 2015 +0000
@@ -10,21 +10,26 @@
 DigitalIn button1(SW3);
 DigitalIn EncoderA(D3);
 DigitalIn EncoderB(D2);
-HIDScope scope(2);
+QEI Encoder(D3, D2, NC, 32);
+HIDScope scope(3);
 Ticker ScopeTime;
+float Aantal_Degs;
+float Aantal_pulses;
 
 void ScopeSend()//Functie die de gegevens voor de scope uitleest en doorstuurt
 {
     scope.set(0, motor2direction.read());
     scope.set(1, motor2speed.read());
+    scope.set(2, Aantal_Degs);
+    Aantal_Degs = Encoder.getPulses()*360/31/131;
     scope.send();
+    
 }
 
 int main()
 {
     motor2direction = 0;
     motor2speed = 0;
-    wait(2);
     led = 1;
     pc.baud(115200);
     pc.printf("Tot aan loop werkt");
@@ -33,14 +38,14 @@
     
     while (true) 
     {
+
        motor2direction = 1;
        motor2speed = 0.5f;
-       pc.printf("1\n");
-       wait(0.1);
-       pc.printf("2222222222\n");
+       wait(1);
+
        motor2direction = 0;
-       motor2speed = 0.3f;
-       pc.printf("333\n");
+       motor2speed = 0.5f;
+       wait(1);
       
     }
 }
\ No newline at end of file