mxttymitch:
I have managed to fix it...However, now the left and right arrows are constantly being pressed.
the 3 pos switch (restraints) isnt working now either. Can you help?
if (selectorPOS == LOW){
Keyboard.press(KEY_LEFT_ARROW);
delay (100);
Keyboard.releaseAll();}
else{
Keyboard.press(KEY_RIGHT_ARROW);
delay (100);
Keyboard.releaseAll();}
Code says selector pressed returns left arrow. Selector not pressed returns right arrow. You will always have one or the other.
const int restraintsOPEN = 11;
const int restraintsCLOSED = 12;
....
//Restraints
if (restraintsOPEN == LOW){
Keyboard.press(KEY_UP_ARROW);
delay(100);
Keyboard.releaseAll();}
if (restraintsCLOSED == LOW){
Keyboard.press(KEY_DOWN_ARROW);
delay(100);
Keyboard.releaseAll();}
You are testing your integer variables for LOW. You want
if (digitalRead(restraintsOPEN) == LOW){
...