Created
January 21, 2021 20:53
-
-
Save danclien/6cdebcb4c5f78fce26b8000f545c38f7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Presses F15 every 30 seconds to keep a computer awake | |
// Tested on an Arduino Micro | |
#include <Keyboard.h> | |
void setup() { | |
// Initialize digital pin LED_BUILTIN as an output. | |
pinMode(LED_BUILTIN, OUTPUT); | |
// Initialize keyboard library | |
Keyboard.begin(); | |
} | |
void loop() { | |
digitalWrite(LED_BUILTIN, HIGH); // Turn on the LED | |
// Push F15 for 200ms | |
Keyboard.press(KEY_F15); | |
delay(200); | |
Keyboard.release(KEY_F15); | |
digitalWrite(LED_BUILTIN, LOW); // Turn off the LED | |
delay(30000); // Wait 30 seconds to run again | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment