| You are currently viewing a revision titled "Arduino Macro A-1", saved on November 23, 2022 at 9:05 pm by Patrick Burcham | |
|---|---|
| Title | Arduino Macro A-1 |
| Content | #include
int buttonPin = 9;
int buttonPinA= 7;
int buttonPinB= 8; // Set a button to any pin
int buttonPinC= 6;
int buttonPinD= 14;
int buttonPinE= 5;
int buttonPinF= 4;
int buttonPinG= 3;
int buttonPinH= 2;
int buttonPinI= 15;
int buttonPinJ= 16;
int buttonPinK= 17;
int buttonPinL= 10;
void setup()
{
pinMode(buttonPin, INPUT);
pinMode(buttonPinA, INPUT); // Set the button as an input
pinMode(buttonPinB, INPUT);
pinMode(buttonPinC, INPUT);
pinMode(buttonPinD, INPUT);
pinMode(buttonPinE, INPUT);
pinMode(buttonPinF, INPUT);
pinMode(buttonPinG, INPUT);
pinMode(buttonPinH, INPUT);
pinMode(buttonPinI, INPUT);
pinMode(buttonPinJ, INPUT);
pinMode(buttonPinK, INPUT);
pinMode(buttonPinL, INPUT);
digitalWrite(buttonPin, HIGH);
digitalWrite(buttonPinA, HIGH);// Pull the button high
digitalWrite(buttonPinB, HIGH);
digitalWrite(buttonPinC, HIGH);
digitalWrite(buttonPinD, HIGH);
digitalWrite(buttonPinE, HIGH);
digitalWrite(buttonPinF, HIGH);
digitalWrite(buttonPinG, HIGH);
digitalWrite(buttonPinH, HIGH);
digitalWrite(buttonPinI, HIGH);
digitalWrite(buttonPinJ, HIGH);
digitalWrite(buttonPinK, LOW);
digitalWrite(buttonPinL, HIGH);
}
void loop()
{
// Bill's Key /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if (digitalRead(buttonPin) == 0) // if the button goes low
{
Keyboard.println("S/O Bill"); // send a 'z' to the computer via Keyboard HID
delay(500); // delay so there aren't a kajillion z'sS/O Randall
}
// B: Randall's Key //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if (digitalRead(buttonPinB) == 0) // if the button goes low
{
Keyboard.println("S/O Randall"); // send a 'z' to the computer via Keyboard HID
delay(500); // delay so there aren't a kajillion z'sS/O Randall
}
// C: Hannah's Key//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if (digitalRead(buttonPinC) == 0) // if the button goes low
{
Keyboard.println("S/O Hannah"); // send a 'z' to the computer via Keyboard HID
delay(500); // delay so there aren't a kajillion z'sS/O Randall
}
// D: Andrew's Key//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if (digitalRead(buttonPinD) == 0) // if the button goes low
{
Keyboard.println("EMT: Andrew"); // send a 'z' to the computer via Keyboard HID
delay(500); // delay so there aren't a kajillion z'sS/O Randall
}
//E: Jeff's key ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if (digitalRead(buttonPinE) == 0) // if the button goes low
{
Keyboard.println("EMT: Jeff"); // send a 'z' to the computer via Keyboard HID
delay(500); // delay so there aren't a kajillion z'sS/O Randall
}
// F: Jang's Key /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if (digitalRead(buttonPinF) == 0) // if the button goes low
{
Keyboard.println("EMT: Jang"); // send a 'z' to the computer via Keyboard HID
delay(500); // delay so there aren't a kajillion z'sS/O Randall
}
// G: Brenden's Key //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if (digitalRead(buttonPinG) == 0) // if the button goes low
{
Keyboard.println("EMT: Brenden"); // send a 'z' to the computer via Keyboard HID
delay(500); // delay so there aren't a kajillion z'sS/O Randall
}
// TIME key
if (digitalRead(buttonPinA) == 0) // if the button goes low
{
Keyboard.press(KEY_LEFT_CTRL);
Keyboard.press(KEY_LEFT_SHIFT);
Keyboard.println(';');
delay(500);
Keyboard.releaseAll();
Keyboard.press(KEY_RETURN);
Keyboard.releaseAll();
}
// H: Date key //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if (digitalRead(buttonPinH) == 0) // if the button goes low
{
Keyboard.press(KEY_LEFT_CTRL);
Keyboard.println(';');
delay(500);
Keyboard.releaseAll();
Keyboard.press(KEY_RETURN);
Keyboard.releaseAll();
}
//// Print key ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if (digitalRead(buttonPinI) == 0) // if the button goes low
{
Keyboard.press(KEY_LEFT_CTRL);
Keyboard.print('p');
delay(1000);
Keyboard.releaseAll();
}
// Save AS
if (digitalRead(buttonPinJ) == 0) // if the button goes low
{
Keyboard.press(KEY_F12);
delay(500);
Keyboard.releaseAll();
}
////Keep awake
if(digitalRead(buttonPinK) ==0)
{
Keyboard.press(KEY_F15);
delay(200000);
Keyboard.releaseAll();
}
if (digitalRead(buttonPinL) == 0) // if the button goes low
{
Keyboard.println("Sup: Tracy"); // send a 'z' to the computer via Keyboard HID
delay(500); // delay so there aren't a kajillion z'sS/O Randall
}
}
|
| Excerpt | |
| Footnotes |