![](/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@5:d396168a1b20, 2017-09-13 (annotated)
- Committer:
- tvlogman
- Date:
- Wed Sep 13 12:02:07 2017 +0000
- Revision:
- 5:d396168a1b20
- Parent:
- 4:f74c981d9bc0
- Child:
- 7:1bffab95fc5f
Added "they're just using coconuts" as a welcome message
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 | 3:99a568200720 | 4 | DigitalOut ledG(LED_GREEN); |
tvlogman | 3:99a568200720 | 5 | DigitalOut ledR(LED_RED); |
tvlogman | 3:99a568200720 | 6 | DigitalOut ledB(LED_BLUE); |
vsluiter | 0:c8f15874531b | 7 | MODSERIAL pc(USBTX, USBRX); |
vsluiter | 0:c8f15874531b | 8 | |
vsluiter | 0:c8f15874531b | 9 | int main() |
vsluiter | 0:c8f15874531b | 10 | { |
tvlogman | 2:002f6b69ebaf | 11 | //int i = 0; |
vsluiter | 0:c8f15874531b | 12 | pc.baud(115200); |
Gijsvanoort | 1:40470bc517f1 | 13 | pc.printf("Hello World!\r\n"); |
tvlogman | 5:d396168a1b20 | 14 | pc.printf("They're just using coconuts!"); |
vsluiter | 0:c8f15874531b | 15 | |
tvlogman | 3:99a568200720 | 16 | ledR = true; |
tvlogman | 3:99a568200720 | 17 | ledB = true; |
tvlogman | 4:f74c981d9bc0 | 18 | ledG = true; |
tvlogman | 3:99a568200720 | 19 | |
vsluiter | 0:c8f15874531b | 20 | while (true) { |
tvlogman | 3:99a568200720 | 21 | int keyPress = pc.getc(); |
tvlogman | 3:99a568200720 | 22 | pc.putc(keyPress); |
tvlogman | 4:f74c981d9bc0 | 23 | pc.printf("%i", keyPress); |
tvlogman | 4:f74c981d9bc0 | 24 | |
tvlogman | 4:f74c981d9bc0 | 25 | if(keyPress == 114) |
tvlogman | 4:f74c981d9bc0 | 26 | { |
tvlogman | 4:f74c981d9bc0 | 27 | ledG = true; |
tvlogman | 4:f74c981d9bc0 | 28 | ledB = true; |
tvlogman | 4:f74c981d9bc0 | 29 | ledR = !ledR; |
tvlogman | 4:f74c981d9bc0 | 30 | } |
tvlogman | 4:f74c981d9bc0 | 31 | else if(keyPress == 103) |
tvlogman | 4:f74c981d9bc0 | 32 | { |
tvlogman | 4:f74c981d9bc0 | 33 | ledR = true; |
tvlogman | 4:f74c981d9bc0 | 34 | ledB = true; |
tvlogman | 4:f74c981d9bc0 | 35 | ledG = !ledG; |
tvlogman | 4:f74c981d9bc0 | 36 | } |
tvlogman | 4:f74c981d9bc0 | 37 | else if(keyPress == 98) |
tvlogman | 4:f74c981d9bc0 | 38 | { |
tvlogman | 4:f74c981d9bc0 | 39 | ledR = true; |
tvlogman | 4:f74c981d9bc0 | 40 | ledG = true; |
tvlogman | 4:f74c981d9bc0 | 41 | ledB = !ledB; |
tvlogman | 4:f74c981d9bc0 | 42 | } |
tvlogman | 4:f74c981d9bc0 | 43 | else |
tvlogman | 4:f74c981d9bc0 | 44 | { |
tvlogman | 4:f74c981d9bc0 | 45 | ledG = true; |
tvlogman | 4:f74c981d9bc0 | 46 | ledB = true; |
tvlogman | 4:f74c981d9bc0 | 47 | ledR = true; |
tvlogman | 4:f74c981d9bc0 | 48 | } |
tvlogman | 2:002f6b69ebaf | 49 | |
vsluiter | 0:c8f15874531b | 50 | } |
vsluiter | 0:c8f15874531b | 51 | } |