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
Diff: main.cpp
- Revision:
- 7:1bffab95fc5f
- Parent:
- 6:5f433011819f
- Parent:
- 5:d396168a1b20
- Child:
- 8:0067469c3389
--- a/main.cpp Wed Sep 13 12:06:37 2017 +0000 +++ b/main.cpp Tue Sep 19 14:17:30 2017 +0000 @@ -1,25 +1,31 @@ #include "mbed.h" #include "MODSERIAL.h" -DigitalOut ledG(LED_GREEN); -DigitalOut ledR(LED_RED); -DigitalOut ledB(LED_BLUE); +PwmOut ledPwm(D5); +float pwmPeriod = 1.0/5000.0; + +AnalogIn pot(A5); +DigitalIn button(D3); + MODSERIAL pc(USBTX, USBRX); + int main() { - //int i = 0; + pc.baud(115200); pc.printf("Hello World!\r\n"); - pc.printf("Bananas"); - ledR = true; - ledB = true; + ledPwm.period(pwmPeriod); + while (true) { - int keyPress = pc.getc(); - pc.putc(keyPress); - ledG = !ledG; // toggle a led + float potMeterValue = pot.read(); + ledPwm = potMeterValue; + wait(0.1f); + + } + }