br g5

Dependencies:   mbed QEI HIDScope biquadFilter MODSERIAL FastPWM

Revision:
18:3de4412d8b63
Parent:
17:3751c2c685ca
Child:
19:1a3b61bd88c0
--- a/main.cpp	Mon Sep 23 12:36:08 2019 +0000
+++ b/main.cpp	Mon Sep 23 12:53:07 2019 +0000
@@ -8,21 +8,22 @@
 // functies aan PINs toevoegen
 FastPWM led(PTA1);
 FastPWM motor(D5);
+
 AnalogIn pot(PTB2);
 InterruptIn button(PTB3);
 
 // timer opzetten = ticker
-Ticker ticker;
+Ticker ticker_a;
 
 // opzetten van hoekbepaling
 int pulses = 4200;
-QEI wheel (D13,D12,NC,pulses);
+QEI encoder (D13,D12,NC,pulses);
 
 // aparte functies
 // functie hoekbepaling
 void hoek_bepaling()
 {
-    wheel.getPulses();
+    encoder.getPulses();
 }
 
 //functie motor aansturen met pot
@@ -33,14 +34,21 @@
 }
 
 // functie print output
+void print_output()
+{
+    pc.printf("motor speed is (%i)\r\n",pot.read());
+    pc.printf("pulse is (%i)\r\n",encoder.getPulses());
+}    
 
 void main_loop()
 {
     hoek_bepaling();
     motor_running();
+    print_output();
 }
+
 int main()
 { 
-    ticker.attach(&mainloop, 0.001f);
+    ticker_a.attach(&main_loop, 0.001f);
     while(true){};  
 }
\ No newline at end of file