statemachine
Dependencies: mbed QEI HIDScope biquadFilter MODSERIAL FastPWM
Diff: main.cpp
- Revision:
- 5:9ebcbd39ec3f
- Parent:
- 4:3e9a8f5d9a1a
- Child:
- 6:c2608dedfd70
--- a/main.cpp Fri Sep 20 08:35:52 2019 +0000 +++ b/main.cpp Fri Sep 20 09:01:04 2019 +0000 @@ -7,15 +7,15 @@ Serial pc(USBTX,USBRX); FastPWM led(PTA2); +// QEI (PinName channelA, PinName channelB, PinName index, int pulsesPerRev, Encoding encoding=X2_ENCODING) +int pulses = 624; +QEI wheel (D13,D12,NC, pulses); -float ledb = 0.5f; +// float ledb = 0.5f; int main(){ - printf("Controll with dial\n"); - led.period(0.01f) ; - led.write(0.5f) ; - while(true){ - wait(0.01); - pc.printf("analog input is (%f)\n\r",pot.read()); wait(0.1); - led.write(pot); - } + while(1){ + wait(0.1); + pc.printf("Pulses is: %i\n", wheel.getPulses()); + } + }