// Presses a key every once in a while on Arduino Leonardo / Pro Micro (ATMega32U4) #include "Keyboard.h" const unsigned long waitTime = 300000; // 5 minutes const int buttonPin = 2; void setup() { Serial.begin(9600); Serial.println("Starting HID"); pinMode(buttonPin, INPUT_PULLUP); Keyboard.begin(); } void loop() { int buttonState = digitalRead(buttonPin); if (buttonState == HIGH) { Serial.println("click"); // press key Keyboard.press(129); // https://www.arduino.cc/reference/en/language/functions/usb/keyboard/keyboardmodifiers/ delay(2); Keyboard.release(129); } else { Serial.println("LOW"); } // wait delay(waitTime); }