Met kinematics

Dependencies:   MODSERIAL QEI mbed-dsp mbed

Fork of Motorcode by ProjectGroep23

Revision:
6:1ee8795b7578
Parent:
5:f07bafaf11d7
Child:
7:e21056555296
--- a/main.cpp	Mon Sep 24 14:15:12 2018 +0000
+++ b/main.cpp	Mon Sep 24 14:20:04 2018 +0000
@@ -1,5 +1,6 @@
 #include "mbed.h"
 #include "MODSERIAL.h"
+#include "QEI.h"
 
 Ticker Blinker;
 
@@ -9,7 +10,9 @@
 
 PwmOut  pwmpin(PTA2);
 DigitalOut direct(PTB23);
-AnalogIn enc1(A0);
+AnalogIn pot1(A0);
+
+QEI encoder(D12,D13,NC,32); 
 
 InterruptIn  sw2(SW2);
 InterruptIn  sw3(SW3);
@@ -30,9 +33,9 @@
   
     while (true)
     {
-            pwmpin.write(enc1.read());
+            pwmpin.write(pot1.read());
             direct = 1;
-            pc.printf("%f \r\n", enc1.read());
+            pc.printf("potmeter: %f, encoder: %i \r\n", pot1.read(), encoder.getPulses());
             wait(0.2f);
     }
 }