Translates the true/false of the muscles to the movement that should take place
Dependencies: mbed
Diff: main.cpp
- Revision:
- 0:791d8001d643
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Oct 27 13:21:10 2015 +0000 @@ -0,0 +1,70 @@ +#include "mbed.h" + +DigitalOut gpo(D0); +DigitalOut led(LED_RED); + +//Constants +int m = 100; + +// For making the system work in the end: +// - Replace the input stated directly below +// - Replace the output given with the output needed + +// function determines which movement the system will make +// It will check if the right and/or left muscle is contracted and then mention in which state the system is in + +void check_state(&state_left, &state_right) + //If the left mucle is contracted: + if (state_left == true) + { + //The right muscle is contracted as is the left muscle + if (state_right == true) + { + //Set value to keypress + string state = "keypress"; + } + // The left mucle is contracted and the right is not + else + { + // Set value to left + string state = "left"; + } + } + //If the left muscle is not contracted + else + { + // Right mucle is contracted and left is not + if (state_right == true) + { + //Set value to right + string state = "right"; + } + //None of the muslces is contracted (rest) + else + { + // Set value to rest + string state = "rest"; + } + } + } + +void check_state(&state) { + if (state = state_old) { + sequential = sequential + 1; + if (sequential > m) { + //move motor + + //Don't let sequential fully reset. This way the piano can be played faster. + sequential = sequential/2; + } + } + else { + sequential = 0; + state_old = state; + } + +int main() +{ + check_state() + check_change_state() +} \ No newline at end of file