br g5
Dependencies: mbed QEI HIDScope Motor biquadFilter MODSERIAL FastPWM
Diff: main.cpp
- Revision:
- 6:c2608dedfd70
- Parent:
- 5:9ebcbd39ec3f
- Child:
- 7:d5e07647dfea
- Child:
- 8:b2e57b815f68
--- a/main.cpp Fri Sep 20 09:01:04 2019 +0000 +++ b/main.cpp Fri Sep 20 09:41:43 2019 +0000 @@ -5,17 +5,20 @@ AnalogIn pot(PTB2); Serial pc(USBTX,USBRX); -FastPWM led(PTA2); + +FastPWM motor(D5); -// QEI (PinName channelA, PinName channelB, PinName index, int pulsesPerRev, Encoding encoding=X2_ENCODING) -int pulses = 624; +// Encoding +int pulses = 131; QEI wheel (D13,D12,NC, pulses); -// float ledb = 0.5f; + 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