statemachine
Dependencies: mbed QEI HIDScope biquadFilter MODSERIAL FastPWM
Diff: main.cpp
- Revision:
- 7:d5e07647dfea
- Parent:
- 6:c2608dedfd70
- Child:
- 9:cdcf30051100
--- a/main.cpp Fri Sep 20 09:41:43 2019 +0000 +++ b/main.cpp Fri Sep 20 09:57:41 2019 +0000 @@ -1,24 +1,23 @@ #include "mbed.h" #include "MODSERIAL.h"; #include "FastPWM.h" ; -#include "QEI.h"; + +Serial pc(USBTX,USBRX); + +InterruptIn button1(PTC2); +InterruptIn button2(PTC3); +InterruptIn button3(PTA4); +InterruptIn button4(PTC6); AnalogIn pot(PTB2); -Serial pc(USBTX,USBRX); FastPWM motor(D5); -// Encoding -int pulses = 131; -QEI wheel (D13,D12,NC, pulses); - - 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); - } - - } \ No newline at end of file + 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); + } + }