Opzetje
Dependencies: mbed QEI HIDScope biquadFilter MODSERIAL FastPWM
Diff: main.cpp
- Revision:
- 6:3930811edddf
- Parent:
- 4:86872b89b21c
- Child:
- 7:2f612f32711a
diff -r 86872b89b21c -r 3930811edddf main.cpp --- a/main.cpp Fri Sep 20 09:32:39 2019 +0000 +++ b/main.cpp Mon Sep 23 13:56:11 2019 +0000 @@ -1,6 +1,6 @@ #include "mbed.h" -#include "MODSERIAL.h"; -#include "FastPWM.h" ; +#include "MODSERIAL.h" +#include "FastPWM.h" Serial pc(USBTX,USBRX); @@ -13,11 +13,15 @@ FastPWM motor(D5); -int main(){ - printf("Controll with dial\n"); - while(true){ - wait(0.1); - printf("motor speed is (%f)\n\r",pot.read()); wait(0.1); - motor.write(pot); - } - } +Ticker ticker; + +void motor_speed() +{ + motor.write(pot); +} + +int main() +{ + ticker.attach(&motor_speed, 0.001f); + while(true){}; +} \ No newline at end of file