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@18:1c9dc6caab9d, 2016-11-03 (annotated)
- Committer:
- ronvbree
- Date:
- Thu Nov 03 16:29:31 2016 +0000
- Revision:
- 18:1c9dc6caab9d
- Parent:
- 14:551049a798a3
- Child:
- 19:a82b55a15457
final
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ronvbree | 18:1c9dc6caab9d | 1 | //#include "mbed.h" |
ronvbree | 18:1c9dc6caab9d | 2 | //#include "robot.h" |
ronvbree | 18:1c9dc6caab9d | 3 | // |
ronvbree | 18:1c9dc6caab9d | 4 | //// ====== Hardware stuff ====== |
ronvbree | 18:1c9dc6caab9d | 5 | // |
ronvbree | 18:1c9dc6caab9d | 6 | //Robot robot; |
ronvbree | 18:1c9dc6caab9d | 7 | // |
ronvbree | 18:1c9dc6caab9d | 8 | //AnalogIn emg1(A0); |
ronvbree | 18:1c9dc6caab9d | 9 | //AnalogIn emg2(A1); |
ronvbree | 18:1c9dc6caab9d | 10 | // |
ronvbree | 18:1c9dc6caab9d | 11 | //DigitalOut red(LED_RED); |
ronvbree | 18:1c9dc6caab9d | 12 | //DigitalOut green(LED_GREEN); |
ronvbree | 18:1c9dc6caab9d | 13 | //DigitalOut blue(LED_BLUE); |
ronvbree | 18:1c9dc6caab9d | 14 | // |
ronvbree | 18:1c9dc6caab9d | 15 | ////====== Constants ===== |
ronvbree | 18:1c9dc6caab9d | 16 | // |
ronvbree | 18:1c9dc6caab9d | 17 | //enum RobotCommand{NOTHING, UP, DOWN, FORWARD, BACKWARD}; |
ronvbree | 18:1c9dc6caab9d | 18 | //enum ProgramState{CALIBRATING, UPDOWN, FORBACK}; |
ronvbree | 18:1c9dc6caab9d | 19 | // |
ronvbree | 18:1c9dc6caab9d | 20 | //const float sampleFrequency = 500; |
ronvbree | 18:1c9dc6caab9d | 21 | //const float sampleTime = 1.0f/sampleFrequency; |
ronvbree | 18:1c9dc6caab9d | 22 | // |
ronvbree | 18:1c9dc6caab9d | 23 | // |
ronvbree | 18:1c9dc6caab9d | 24 | ////====== Program Variables ====== |
ronvbree | 18:1c9dc6caab9d | 25 | // |
ronvbree | 18:1c9dc6caab9d | 26 | //ProgramState progState; |
ronvbree | 18:1c9dc6caab9d | 27 | //RobotCommand robotCommand; |
ronvbree | 18:1c9dc6caab9d | 28 | // |
ronvbree | 18:1c9dc6caab9d | 29 | // |
ronvbree | 18:1c9dc6caab9d | 30 | ////====== Functions ====== |
ronvbree | 18:1c9dc6caab9d | 31 | // |
ronvbree | 18:1c9dc6caab9d | 32 | // |
ronvbree | 18:1c9dc6caab9d | 33 | //void calibrate(void) { |
ronvbree | 18:1c9dc6caab9d | 34 | // //Calibrate function -- blocking. |
ronvbree | 18:1c9dc6caab9d | 35 | // //Calculates and sets both emg1threshold and emg2 threshold |
Jankoekenpan | 11:57f0ab4d0e99 | 36 | // |
Jankoekenpan | 11:57f0ab4d0e99 | 37 | // |
Jankoekenpan | 11:57f0ab4d0e99 | 38 | // |
ronvbree | 18:1c9dc6caab9d | 39 | //} |
ronvbree | 18:1c9dc6caab9d | 40 | // |
ronvbree | 18:1c9dc6caab9d | 41 | //void run() { |
ronvbree | 18:1c9dc6caab9d | 42 | // //Run function -- blocking |
ronvbree | 18:1c9dc6caab9d | 43 | // //runs the calibrated robot |
ronvbree | 18:1c9dc6caab9d | 44 | // |
ronvbree | 18:1c9dc6caab9d | 45 | //} |
ronvbree | 18:1c9dc6caab9d | 46 | // |
ronvbree | 18:1c9dc6caab9d | 47 | // |
ronvbree | 18:1c9dc6caab9d | 48 | ////int main() { |
ronvbree | 18:1c9dc6caab9d | 49 | //// progState = CALIBRATING; |
ronvbree | 18:1c9dc6caab9d | 50 | //// |
ronvbree | 18:1c9dc6caab9d | 51 | //// calibrate(); |
ronvbree | 18:1c9dc6caab9d | 52 | //// |
ronvbree | 18:1c9dc6caab9d | 53 | //// progState = UPDOWN; |
ronvbree | 18:1c9dc6caab9d | 54 | //// robotCommand = NOTHING; |
ronvbree | 18:1c9dc6caab9d | 55 | //// |
ronvbree | 18:1c9dc6caab9d | 56 | //// run(); |
ronvbree | 18:1c9dc6caab9d | 57 | //// |
ronvbree | 18:1c9dc6caab9d | 58 | //// while(true); |
ronvbree | 18:1c9dc6caab9d | 59 | //// return 0; |
ronvbree | 18:1c9dc6caab9d | 60 | ////} |