statemachine
Dependencies: mbed QEI HIDScope biquadFilter MODSERIAL FastPWM
main.cpp@16:0ff43ed4d259, 2019-09-23 (annotated)
- Committer:
- boydmartherus
- Date:
- Mon Sep 23 10:09:32 2019 +0000
- Revision:
- 16:0ff43ed4d259
- Parent:
- 10:9101c7a4f219
- Child:
- 17:3751c2c685ca
test rotatie
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
RobertoO | 0:67c50348f842 | 1 | #include "mbed.h" |
boydmartherus | 16:0ff43ed4d259 | 2 | #include "MODSERIAL.h" |
boydmartherus | 16:0ff43ed4d259 | 3 | #include "FastPWM.h" |
boydmartherus | 16:0ff43ed4d259 | 4 | #include "QEI.h" |
boydmartherus | 7:d5e07647dfea | 5 | |
boydmartherus | 7:d5e07647dfea | 6 | Serial pc(USBTX,USBRX); |
boydmartherus | 7:d5e07647dfea | 7 | |
boydmartherus | 16:0ff43ed4d259 | 8 | AnalogIn pot(PTB2); |
boydmartherus | 16:0ff43ed4d259 | 9 | InteruptIn button(PTB3) |
Mortimerz | 3:ea5f67f11825 | 10 | |
boydmartherus | 9:cdcf30051100 | 11 | FastPWM led(PTA1); |
boydmartherus | 16:0ff43ed4d259 | 12 | FastPWM motor(D5); |
boydmartherus | 16:0ff43ed4d259 | 13 | DigitalOut direction(D4); |
boydmartherus | 9:cdcf30051100 | 14 | |
boydmartherus | 16:0ff43ed4d259 | 15 | int pulses = 4200; |
boydmartherus | 10:9101c7a4f219 | 16 | QEI wheel (D13,D12,NC,pulses); |
MarliesWeggemans | 4:3e9a8f5d9a1a | 17 | |
boydmartherus | 10:9101c7a4f219 | 18 | int main() |
boydmartherus | 10:9101c7a4f219 | 19 | { |
boydmartherus | 16:0ff43ed4d259 | 20 | printf("Control with dial\n"); |
boydmartherus | 9:cdcf30051100 | 21 | while(true) |
boydmartherus | 10:9101c7a4f219 | 22 | { |
boydmartherus | 10:9101c7a4f219 | 23 | wait(0.1); |
boydmartherus | 10:9101c7a4f219 | 24 | printf("motor speeed is (%f)\n\r",pot.read()); |
boydmartherus | 10:9101c7a4f219 | 25 | wait(0.1); |
boydmartherus | 10:9101c7a4f219 | 26 | led.write(pot); |
boydmartherus | 16:0ff43ed4d259 | 27 | wait(0.1); |
boydmartherus | 10:9101c7a4f219 | 28 | motor.write(pot); |
boydmartherus | 10:9101c7a4f219 | 29 | wait(0.1); |
boydmartherus | 10:9101c7a4f219 | 30 | printf("pulse number is (%i)\n\r",wheel.getPulses()); |
boydmartherus | 7:d5e07647dfea | 31 | } |
boydmartherus | 10:9101c7a4f219 | 32 | } |