//FloorBoard - Foot Operated 3 Button Board

// Libraries
#include <HID-Project.h>  //  https://www.arduino.cc/reference/en/libraries/hid-project/

// constants won't change. They're used here to
// set pin numbers:
const int button1Pin = 3;     // the number of the pushbutton pin CTRL
const int button2Pin = 7;     // the number of the pushbutton pin ALT
const int button3Pin = 11;    // the number of the pushbutton pin SHIFT

// variables will change:
int button1State = 0;         // variable for reading the pushbutton 1 status
int button2State = 0;         // variable for reading the pushbutton 2 status
int button3State = 0;         // variable for reading the pushbutton 3 status

void setup() {
 
  // initialize the pushbutton pin as an input:
  pinMode(button1Pin, INPUT_PULLUP);  
  pinMode(button2Pin, INPUT_PULLUP);
  pinMode(button3Pin, INPUT_PULLUP);
}

void loop()  { 
  
  // read the state of the pushbutton value:
  button1State = digitalRead(button1Pin);
  button2State = digitalRead(button2Pin);
  button3State = digitalRead(button3Pin);

  // check if pushbutton 1 is pressed.
  // if it is, the buttonState is LOW:
  if(button1State == LOW)
  {
  Keyboard.press(KEY_LEFT_CTRL); //Emulate CTRL key press
  }
  
  // check if pushbutton 2 is pressed.
  // if it is, the buttonState is LOW:
  if(button2State == LOW)
  {
  Keyboard.press(KEY_LEFT_ALT); //Emulate ALT key press
  }
  
  // check if pushbutton 3 is pressed.
  // if it is, the buttonState is LOW:
  if(button3State == LOW)
  {
  Keyboard.press(KEY_LEFT_SHIFT); //Emulate SHIFT key press
  }
  
 // If all three buttons are not pressed, reset keyboard commands
 if((button1State != LOW) && (button2State != LOW) && (button3State != LOW))
 {
 Keyboard.releaseAll();
 } 

}
