Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed QEI HIDScope biquadFilter MODSERIAL FastPWM
Diff: main.cpp
- Revision:
- 7:af0c16ae48d7
- Parent:
- 6:41b02057fc2c
- Child:
- 8:ccd58f78b5cb
--- a/main.cpp Tue Oct 01 13:11:49 2019 +0000 +++ b/main.cpp Tue Oct 01 13:31:36 2019 +0000 @@ -6,6 +6,8 @@ DigitalOut ledr(LED_RED); enum States {MovementIdle, CalibrationIdle, Demo, Startup, CalibrationPhysical, Move, TiltCup, FailState}; States CurrentState; +char ledcolor; //r is red, b is blue, g is green, t is bluegreen, p is purple +Ticker Tick_Blinky;//used for the blinking of the leds void Run_Demo(void) { @@ -13,6 +15,8 @@ ledr=true; ledb=true;//only turns on the green light + Tick_Blinky.attach() + } void Run_MovementIdle(void) @@ -52,11 +56,7 @@ void Run_FailState(void) { - ledg=true; - ledb=true; - while(true){ - ledr=!ledr; - wait(0.5f); } + } //State Machine @@ -66,30 +66,39 @@ { case Demo: Run_Demo; + ledcolor='t'; break; case MovementIdle: Run_MovementIdle; + ledcolor='b'; break; case CalibrationIdle: Run_CalibrationIdle; + ledcolor='b'; break; case Startup; Run_Startup; + ledcolor='b'; break; case CalibrationPhysical: Run_CalibrationPhysical; + ledcolor='g'; break; case CalibrationEMG: Run_CalibrationEMG; + ledcolor='g'; break; case Move: Run_Move; + ledcolor='p'; break; case TiltCup: Run_TiltCup; + ledcolor='t'; break; case FailState: Run_FailState; + ledcolor='r'; break; } }