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 biquadFilter
Diff: main.cpp
- Revision:
- 8:874fe459b10a
- Parent:
- 5:23c850380b86
--- a/main.cpp Wed Nov 02 09:25:03 2016 +0000 +++ b/main.cpp Wed Nov 02 11:09:32 2016 +0000 @@ -1,5 +1,7 @@ #include "arm.h" #include "mbed.h" +#include "robot.h" +#include "filter.h" // ====== Hardware stuff ====== @@ -8,11 +10,19 @@ AnalogIn emg1(A0); AnalogIn emg2(A1); -//====== Types ===== +DigitalOut red(LED_RED); +DigitalOut green(LED_GREEN); +DigitalOut blue(LED_BLUE); + +//====== Constants ===== enum DirectionState{UP = true, DOWN = false}; enum ProgramState{CALIBRATING, RUNNING}; +const float sampleFrequency = 500; +const float sampleTime = 1.0f/sampleFrequency; + + //====== Program Variables ====== ProgramState progState; @@ -21,11 +31,19 @@ float emg1threshold; float emg2threshold; +Ticker sampler; + +Filter filter1; +Filter filter2; + //====== Functions ====== void calibrate(void) { //Calibrate function -- blocking. + //Calculates and sets both emg1threshold and emg2 threshold + + }