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
main.cpp@6:05f73a8474ca, 2016-11-02 (annotated)
- Committer:
- ronvbree
- Date:
- Wed Nov 02 09:26:38 2016 +0000
- Revision:
- 6:05f73a8474ca
- Parent:
- 5:23c850380b86
include roboto
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Jankoekenpan | 1:7d218e9d2111 | 1 | #include "arm.h" |
Jankoekenpan | 5:23c850380b86 | 2 | #include "mbed.h" |
ronvbree | 6:05f73a8474ca | 3 | #include "robot.h" |
Jankoekenpan | 1:7d218e9d2111 | 4 | |
Jankoekenpan | 1:7d218e9d2111 | 5 | // ====== Hardware stuff ====== |
Jankoekenpan | 1:7d218e9d2111 | 6 | |
Jankoekenpan | 5:23c850380b86 | 7 | Robot robot; |
Jankoekenpan | 1:7d218e9d2111 | 8 | |
Jankoekenpan | 5:23c850380b86 | 9 | AnalogIn emg1(A0); |
Jankoekenpan | 5:23c850380b86 | 10 | AnalogIn emg2(A1); |
Jankoekenpan | 1:7d218e9d2111 | 11 | |
Jankoekenpan | 1:7d218e9d2111 | 12 | //====== Types ===== |
Jankoekenpan | 1:7d218e9d2111 | 13 | |
Jankoekenpan | 1:7d218e9d2111 | 14 | enum DirectionState{UP = true, DOWN = false}; |
Jankoekenpan | 1:7d218e9d2111 | 15 | enum ProgramState{CALIBRATING, RUNNING}; |
Jankoekenpan | 1:7d218e9d2111 | 16 | |
Jankoekenpan | 1:7d218e9d2111 | 17 | //====== Program Variables ====== |
Jankoekenpan | 1:7d218e9d2111 | 18 | |
Jankoekenpan | 1:7d218e9d2111 | 19 | ProgramState progState; |
Jankoekenpan | 1:7d218e9d2111 | 20 | DirectionState dirState; |
Jankoekenpan | 1:7d218e9d2111 | 21 | |
Jankoekenpan | 1:7d218e9d2111 | 22 | float emg1threshold; |
Jankoekenpan | 1:7d218e9d2111 | 23 | float emg2threshold; |
Jankoekenpan | 1:7d218e9d2111 | 24 | |
Jankoekenpan | 1:7d218e9d2111 | 25 | //====== Functions ====== |
Jankoekenpan | 1:7d218e9d2111 | 26 | |
Jankoekenpan | 1:7d218e9d2111 | 27 | |
Jankoekenpan | 1:7d218e9d2111 | 28 | void calibrate(void) { |
Jankoekenpan | 5:23c850380b86 | 29 | //Calibrate function -- blocking. |
Jankoekenpan | 1:7d218e9d2111 | 30 | |
Jankoekenpan | 1:7d218e9d2111 | 31 | } |
Jankoekenpan | 1:7d218e9d2111 | 32 | |
Jankoekenpan | 1:7d218e9d2111 | 33 | |
Jankoekenpan | 1:7d218e9d2111 | 34 | int main() { |
Jankoekenpan | 1:7d218e9d2111 | 35 | progState = CALIBRATING; |
Jankoekenpan | 1:7d218e9d2111 | 36 | calibrate(); |
Jankoekenpan | 1:7d218e9d2111 | 37 | |
Jankoekenpan | 1:7d218e9d2111 | 38 | |
Jankoekenpan | 1:7d218e9d2111 | 39 | while(true); |
Jankoekenpan | 1:7d218e9d2111 | 40 | return 0; |
Jankoekenpan | 1:7d218e9d2111 | 41 | } |