![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Control up to two motors using filtered EMG signals and a PID controller
Dependencies: FastPWM HIDScope MODSERIAL QEI Matrix biquadFilter controller errorFetch mbed motorConfig refGen MatrixMath inverseKinematics
Fork of Minor_test_serial by
main.cpp@11:d1692be2de30, 2017-09-21 (annotated)
- Committer:
- tvlogman
- Date:
- Thu Sep 21 08:20:49 2017 +0000
- Revision:
- 11:d1692be2de30
- Parent:
- 10:e23cbcdde7e3
- Child:
- 12:0462757e1ed2
Encoder reading now works - removed HIDscope as that seemed to be the problem
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
vsluiter | 0:c8f15874531b | 1 | #include "mbed.h" |
vsluiter | 0:c8f15874531b | 2 | #include "MODSERIAL.h" |
tvlogman | 8:0067469c3389 | 3 | #include "HIDScope.h" |
tvlogman | 9:5f0e796c9489 | 4 | #include "QEI.h" |
tvlogman | 8:0067469c3389 | 5 | |
tvlogman | 10:e23cbcdde7e3 | 6 | QEI Encoder(D12,D13,NC,32); |
tvlogman | 10:e23cbcdde7e3 | 7 | MODSERIAL pc(USBTX, USBRX); |
tvlogman | 8:0067469c3389 | 8 | |
tvlogman | 10:e23cbcdde7e3 | 9 | Ticker encoderTicker; |
tvlogman | 10:e23cbcdde7e3 | 10 | volatile int counts = 0; |
tvlogman | 8:0067469c3389 | 11 | |
tvlogman | 7:1bffab95fc5f | 12 | |
tvlogman | 10:e23cbcdde7e3 | 13 | void readEncoder(){ |
tvlogman | 10:e23cbcdde7e3 | 14 | counts = Encoder.getPulses(); |
tvlogman | 10:e23cbcdde7e3 | 15 | pc.printf("%i pulses", counts); |
tvlogman | 10:e23cbcdde7e3 | 16 | } |
vsluiter | 0:c8f15874531b | 17 | |
tvlogman | 7:1bffab95fc5f | 18 | |
vsluiter | 0:c8f15874531b | 19 | int main() |
tvlogman | 10:e23cbcdde7e3 | 20 | { |
vsluiter | 0:c8f15874531b | 21 | pc.baud(115200); |
tvlogman | 11:d1692be2de30 | 22 | encoderTicker.attach(readEncoder, 0.5); |
tvlogman | 10:e23cbcdde7e3 | 23 | pc.printf("Encoder ticker attached and baudrate set"); |
tvlogman | 11:d1692be2de30 | 24 | |
vsluiter | 0:c8f15874531b | 25 | } |
tvlogman | 7:1bffab95fc5f | 26 |