br g5
Dependencies: mbed QEI HIDScope Motor biquadFilter MODSERIAL FastPWM
Diff: main.cpp
- Revision:
- 8:b2e57b815f68
- Parent:
- 6:c2608dedfd70
--- a/main.cpp Fri Sep 20 09:41:43 2019 +0000 +++ b/main.cpp Fri Sep 20 10:16:14 2019 +0000 @@ -3,9 +3,10 @@ #include "FastPWM.h" ; #include "QEI.h"; -AnalogIn pot(PTB2); Serial pc(USBTX,USBRX); +// motor control +AnalogIn pot(PTB2); FastPWM motor(D5); // Encoding @@ -13,12 +14,16 @@ QEI wheel (D13,D12,NC, pulses); -int main(){ +int main() +{ while(1){ wait(0.1); - pc.printf("Pulses is: %i\n", wheel.getPulses()); - printf("motor relative speed is (%f)\n\r",pot.read()); - motor.write(pot); + printf("motor relative speed is (%f)\n\r",pot.read()); + wait(0.1); + motor.write(pot); } - - } \ No newline at end of file + while(true){ + wait(0.1); + pc.printf("Pulses is: %i\n", wheel.getPulses()); + wait(0.1); +} \ No newline at end of file