Skip to content

Instantly share code, notes, and snippets.

@bricklife
Last active May 27, 2020 04:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bricklife/c85589f9eae912461b13ebf68fd54eb6 to your computer and use it in GitHub Desktop.
Save bricklife/c85589f9eae912461b13ebf68fd54eb6 to your computer and use it in GitHub Desktop.
#include <Bounce.h>
Bounce button = Bounce(1, 10);
void setup() {
pinMode(1, INPUT_PULLUP);
}
void loop() {
button.update();
if (button.fallingEdge()) {
Keyboard.set_modifier(MODIFIERKEY_GUI);
Keyboard.set_key1(KEY_D);
Keyboard.send_now();
}
if (button.risingEdge()) {
Keyboard.set_modifier(0);
Keyboard.set_key1(0);
Keyboard.send_now();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment