Skip to content

Instantly share code, notes, and snippets.

@bricklife
Created May 27, 2020 04:52
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/a9ef45c1283e56c0a1b568113e9f3bb3 to your computer and use it in GitHub Desktop.
Save bricklife/a9ef45c1283e56c0a1b568113e9f3bb3 to your computer and use it in GitHub Desktop.
#include "DigiKeyboard.h"
bool pressing = false;
void setup() {
pinMode(0, INPUT);
digitalWrite(0, HIGH); // Pull Up
}
void loop() {
if (digitalRead(0) == LOW && !pressing) {
pressing = true;
DigiKeyboard.sendKeyPress(KEY_D, MOD_GUI_LEFT);
}
if (digitalRead(0) == HIGH && pressing) {
pressing = false;
DigiKeyboard.sendKeyPress(0, 0);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment