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
test_main.cpp
- Committer:
- Jankoekenpan
- Date:
- 2016-11-03
- Revision:
- 9:3193094ba3b2
- Parent:
- main.cpp@ 8:874fe459b10a
- Child:
- 11:57f0ab4d0e99
File content as of revision 9:3193094ba3b2:
#include "arm.h" #include "mbed.h" #include "robot.h" #include "filter.h" // ====== Hardware stuff ====== Robot robot; AnalogIn emg1(A0); AnalogIn emg2(A1); DigitalOut red(LED_RED); DigitalOut green(LED_GREEN); DigitalOut blue(LED_BLUE); //====== Constants ===== enum DirectionState{NOTHING, UP, DOWN, FORWARD, BACKWARD}; enum ProgramState{CALIBRATING, UPDOWN, FORBACK}; const float sampleFrequency = 500; const float sampleTime = 1.0f/sampleFrequency; //====== Program Variables ====== ProgramState progState; DirectionState dirState; //====== Functions ====== void calibrate(void) { //Calibrate function -- blocking. //Calculates and sets both emg1threshold and emg2 threshold } void run() { //Run function -- blocking //runs the calibrated robot } int main() { progState = CALIBRATING; calibrate(); progState = UPDOWN; run(); while(true); return 0; }