![](/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@10:e23cbcdde7e3, 2017-09-21 (annotated)
- Committer:
- tvlogman
- Date:
- Thu Sep 21 08:12:58 2017 +0000
- Revision:
- 10:e23cbcdde7e3
- Parent:
- 9:5f0e796c9489
- Child:
- 11:d1692be2de30
With encoder reading - not doing anything just yet;
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 | 8:0067469c3389 | 7 | HIDScope scope(2); |
tvlogman | 10:e23cbcdde7e3 | 8 | MODSERIAL pc(USBTX, USBRX); |
tvlogman | 8:0067469c3389 | 9 | |
tvlogman | 10:e23cbcdde7e3 | 10 | Ticker encoderTicker; |
tvlogman | 10:e23cbcdde7e3 | 11 | volatile int counts = 0; |
tvlogman | 8:0067469c3389 | 12 | |
tvlogman | 7:1bffab95fc5f | 13 | |
tvlogman | 10:e23cbcdde7e3 | 14 | void readEncoder(){ |
tvlogman | 10:e23cbcdde7e3 | 15 | counts = Encoder.getPulses(); |
tvlogman | 10:e23cbcdde7e3 | 16 | pc.printf("%i pulses", counts); |
tvlogman | 10:e23cbcdde7e3 | 17 | } |
vsluiter | 0:c8f15874531b | 18 | |
tvlogman | 7:1bffab95fc5f | 19 | |
vsluiter | 0:c8f15874531b | 20 | int main() |
tvlogman | 10:e23cbcdde7e3 | 21 | { |
vsluiter | 0:c8f15874531b | 22 | pc.baud(115200); |
tvlogman | 10:e23cbcdde7e3 | 23 | pc.printf("Encoder ticker attached and baudrate set"); |
tvlogman | 10:e23cbcdde7e3 | 24 | encoderTicker.attach(readEncoder, 2.0); |
vsluiter | 0:c8f15874531b | 25 | } |
tvlogman | 7:1bffab95fc5f | 26 |