Return key always being pressed

Gabriel_swe:

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){
...

Hi, because the enter/arrows are constantly being pressed it is extremely difficult to upload new code...
I get the error:
couldn't find a Board on the selected port. Check that you have the correct port selected. If it is correct, try pressing the board's reset button after initiating the upload.

It is plugged in and correct port is selected. However, while it is plugged in I cannot use the buttons at the top (tools ect) because pf the keys constantly being pressed.
Any suggestions?