Hidde van der Bijl / Mbed 2 deprecated biorobotics_four_scorers2

Dependencies:   mbed QEI HIDScope biquadFilter MODSERIAL FastPWM

Revision:
4:36e32ddf2443
Parent:
3:e3d12393adb1
Child:
5:aa8b5d5e632f
--- a/main.cpp	Wed Oct 02 12:45:18 2019 +0000
+++ b/main.cpp	Wed Oct 02 12:49:05 2019 +0000
@@ -3,11 +3,10 @@
 #include "FastPWM.h"
 #include "QEI.h"
 
-MODSERIAL pc(USBTX, USBRX);
-DigitalOut motor2_direction(D4);
-PwmOut motor2_pwm(D5);
+MODSERIAL pc(USBTX, USBRX);         //verbinden met pc
+DigitalOut motor2_direction(D4);    //verbinden met motor 2 op board (altijd d4)
 
-QEI encoder (D11, D12, NC, 8400, QEI::X4_ENCODING);
+QEI encoder (D11, D12, NC, 8400, QEI::X4_ENCODING); //encoder gebruiken
 
 int enc_count;
 int prev_count = 0;
@@ -17,8 +16,8 @@
     pc.printf("initializing\r\n");
     
     while (true) {
-        enc_count = encoder.getPulses();
-        pc.printf("%f\r\n", float(enc_count-prev_count)*360/(8400*0.025));
+        enc_count = encoder.getPulses(); //kijkt op welke stand hij nu staat
+        pc.printf("%f\r\n", float(enc_count-prev_count)*360/(8400*0.025)); //verschil met vorige stap in graden per stap gedeeld door tijd = snelheid
         prev_count = enc_count;
         wait_ms(25);
     }