![](/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@7:1bffab95fc5f, 2017-09-19 (annotated)
- Committer:
- tvlogman
- Date:
- Tue Sep 19 14:17:30 2017 +0000
- Revision:
- 7:1bffab95fc5f
- Parent:
- 6:5f433011819f
- Parent:
- 5:d396168a1b20
- Child:
- 8:0067469c3389
Working potmeter controlled LED;
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" |
vsluiter | 0:c8f15874531b | 3 | |
tvlogman | 7:1bffab95fc5f | 4 | PwmOut ledPwm(D5); |
tvlogman | 7:1bffab95fc5f | 5 | float pwmPeriod = 1.0/5000.0; |
tvlogman | 7:1bffab95fc5f | 6 | |
tvlogman | 7:1bffab95fc5f | 7 | AnalogIn pot(A5); |
tvlogman | 7:1bffab95fc5f | 8 | DigitalIn button(D3); |
tvlogman | 7:1bffab95fc5f | 9 | |
vsluiter | 0:c8f15874531b | 10 | MODSERIAL pc(USBTX, USBRX); |
vsluiter | 0:c8f15874531b | 11 | |
tvlogman | 7:1bffab95fc5f | 12 | |
vsluiter | 0:c8f15874531b | 13 | int main() |
vsluiter | 0:c8f15874531b | 14 | { |
tvlogman | 7:1bffab95fc5f | 15 | |
vsluiter | 0:c8f15874531b | 16 | pc.baud(115200); |
Gijsvanoort | 1:40470bc517f1 | 17 | pc.printf("Hello World!\r\n"); |
vsluiter | 0:c8f15874531b | 18 | |
tvlogman | 7:1bffab95fc5f | 19 | ledPwm.period(pwmPeriod); |
tvlogman | 7:1bffab95fc5f | 20 | |
tvlogman | 3:99a568200720 | 21 | |
vsluiter | 0:c8f15874531b | 22 | while (true) { |
tvlogman | 7:1bffab95fc5f | 23 | float potMeterValue = pot.read(); |
tvlogman | 7:1bffab95fc5f | 24 | ledPwm = potMeterValue; |
tvlogman | 7:1bffab95fc5f | 25 | wait(0.1f); |
tvlogman | 7:1bffab95fc5f | 26 | |
tvlogman | 4:f74c981d9bc0 | 27 | |
tvlogman | 7:1bffab95fc5f | 28 | |
vsluiter | 0:c8f15874531b | 29 | } |
tvlogman | 7:1bffab95fc5f | 30 | |
vsluiter | 0:c8f15874531b | 31 | } |