Skip to content

Instantly share code, notes, and snippets.

@thnikk
Created October 1, 2018 05:51
Show Gist options
  • Save thnikk/4e336c8dbed5c5ef3d875da19c046c49 to your computer and use it in GitHub Desktop.
Save thnikk/4e336c8dbed5c5ef3d875da19c046c49 to your computer and use it in GitHub Desktop.
#include <HID-Project.h>
#include <HID-Settings.h>
const byte pins[] = { 2, 3, 7, 9, 10, 11, 12, 4 };
char mapping[] = {"sdfjkl `"};
bool buttonCheck[8];
void setup() {
for(byte x=0; x<8; x++) pinMode(pins[x], INPUT_PULLUP);
NKROKeyboard.begin();
}
void loop() {
for(byte x=0; x<8; x++) {
if (!digitalRead(pins[x]) && !buttonCheck[x]) { NKROKeyboard.press(mapping[x]); buttonCheck[x] = 1; }
if (digitalRead(pins[x]) && buttonCheck[x]) { NKROKeyboard.release(mapping[x]); buttonCheck[x] = 0; }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment