![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
statemachine
Dependencies: mbed QEI HIDScope biquadFilter MODSERIAL FastPWM
Diff: main.cpp
- Revision:
- 19:1a3b61bd88c0
- Parent:
- 18:3de4412d8b63
- Child:
- 20:184839c241a7
--- a/main.cpp Mon Sep 23 12:53:07 2019 +0000 +++ b/main.cpp Fri Oct 04 08:08:55 2019 +0000 @@ -13,7 +13,7 @@ InterruptIn button(PTB3); // timer opzetten = ticker -Ticker ticker_a; +Ticker ticker; // opzetten van hoekbepaling int pulses = 4200; @@ -36,7 +36,7 @@ // functie print output void print_output() { - pc.printf("motor speed is (%i)\r\n",pot.read()); + pc.printf("motor speed is (%f)\r\n",pot.read()); pc.printf("pulse is (%i)\r\n",encoder.getPulses()); } @@ -44,11 +44,17 @@ { hoek_bepaling(); motor_running(); +} + +void print_loop() +{ print_output(); } +enum (start_wait, move) + int main() { - ticker_a.attach(&main_loop, 0.001f); + ticker.attach(&main_loop, 0.001f, &print_loop, 1f); while(true){}; } \ No newline at end of file