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