OTES/Firmware/button.ino
2025-01-02 16:29:18 -08:00

20 lines
429 B
C++

#include <Keyboard.h>
int buttonPin = 9; // Set a button to any pin
void setup()
{
pinMode(buttonPin, INPUT_PULLUP); // Set the button as an input
Keyboard.begin();
}
void loop()
{
if (digitalRead(buttonPin) == 0) // if the button goes low
{
Keyboard.press('z'); // send a 'z' to the computer via Keyboard HID // delay so there aren't a kajillion z's
}else{
Keyboard.releaseAll();
}
delay(50);
}