Checks which muscles are activated and gives and output (left/right/keypress/rest)
Dependencies: mbed
main.cpp@0:8aba349193ec, 2015-10-16 (annotated)
- Committer:
- woutende
- Date:
- Fri Oct 16 10:01:46 2015 +0000
- Revision:
- 0:8aba349193ec
Check_state first version. Pay attention to the fact that in the end the in- and output names have to change to work together properly
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
woutende | 0:8aba349193ec | 1 | #include "mbed.h" |
woutende | 0:8aba349193ec | 2 | |
woutende | 0:8aba349193ec | 3 | bool state_left = false; |
woutende | 0:8aba349193ec | 4 | bool state_right = true; |
woutende | 0:8aba349193ec | 5 | |
woutende | 0:8aba349193ec | 6 | int main() |
woutende | 0:8aba349193ec | 7 | { |
woutende | 0:8aba349193ec | 8 | if (state_left == true) |
woutende | 0:8aba349193ec | 9 | { |
woutende | 0:8aba349193ec | 10 | if (state_right == true) |
woutende | 0:8aba349193ec | 11 | { |
woutende | 0:8aba349193ec | 12 | std::string state = "keypress"; |
woutende | 0:8aba349193ec | 13 | std::cout << state; |
woutende | 0:8aba349193ec | 14 | } |
woutende | 0:8aba349193ec | 15 | else |
woutende | 0:8aba349193ec | 16 | { |
woutende | 0:8aba349193ec | 17 | std::string state = "left"; |
woutende | 0:8aba349193ec | 18 | std::cout << state; |
woutende | 0:8aba349193ec | 19 | } |
woutende | 0:8aba349193ec | 20 | } |
woutende | 0:8aba349193ec | 21 | else |
woutende | 0:8aba349193ec | 22 | { |
woutende | 0:8aba349193ec | 23 | if (state_right == true) |
woutende | 0:8aba349193ec | 24 | { |
woutende | 0:8aba349193ec | 25 | std::string state = "right"; |
woutende | 0:8aba349193ec | 26 | std::cout << state; |
woutende | 0:8aba349193ec | 27 | } |
woutende | 0:8aba349193ec | 28 | else |
woutende | 0:8aba349193ec | 29 | { |
woutende | 0:8aba349193ec | 30 | std::string state = "rest"; |
woutende | 0:8aba349193ec | 31 | std::cout << state; |
woutende | 0:8aba349193ec | 32 | } |
woutende | 0:8aba349193ec | 33 | } |
woutende | 0:8aba349193ec | 34 | } |