So i have done some editing to that one now where do I Put my Keystrokes in at?
I am still very new to programming. Thanks!!
const byte 3 = A1;
const byte 5 = A2;
unsigned long waitStart;
unsigned long currentMillis;
unsigned long period = 15000;
const byte waitingForEitherButton = 0;
const byte waitingForButton2 = 1;
const byte waitingForButton1 = 2;
const byte bothButtonsPressed = 3;
byte currentState = waitingForEitherButton;
void setup()
{
pinMode(9, INPUT_PULLUP);
pinMode(5, INPUT_PULLUP);
pinMode(3, INPUT_PULLUP);
Keyboard.begin();
digitalWrite(9, HIGH);
digitalWrite(5, HIGH);
digitalWrite(3, HIGH);
Serial.begin(115200);
pinMode(3, INPUT_PULLUP);
pinMode(5, INPUT_PULLUP);
}
void loop()
{
currentMillis = millis();
switch (currentState)
{
case waitingForEitherButton:
if (digitalRead(3) == LOW)
{
currentState = waitingForButton2;
waitStart = currentMillis;
}
if (digitalRead(5) == LOW)
{
currentState = waitingForButton1;
waitStart = currentMillis;
}
break;
//
case waitingForButton2:
if (currentMillis - waitStart >= period)
{
currentState = waitingForEitherButton;
}
if (digitalRead(5) == LOW)
{
currentState = bothButtonsPressed;
}
break;
//
case waitingForButton1:
if (currentMillis - waitStart >= period)
{
currentState = waitingForEitherButton; //waiting
}
if (digitalRead(3) == LOW)
{
currentState = bothButtonsPressed;
}
break;
//
case bothButtonsPressed:
delay(2000); //naughty, but easy
currentState = waitingForEitherButton;
break;
}
}