Skip to content

Instantly share code, notes, and snippets.

@unixunion
Created July 23, 2023 14:43
Show Gist options
  • Save unixunion/301f619a3065e532973942e8c4e51daa to your computer and use it in GitHub Desktop.
Save unixunion/301f619a3065e532973942e8c4e51daa to your computer and use it in GitHub Desktop.
/*
Copyright (c) 2023 Kegan Holtzhausen
Foot controls for common translation software, back, pause/play, advance
Requires a hoodloader2 flashed UNO or other suitable microcontroller
Switches are wired to the ICSP header of the 16u2 on the UNO ( official models ).
Some knockoffs do not have the second header.
*/
#include "HID-Project.h"
void setup() {
for (int i = 3; i <= 7; i++) {
pinMode(i, INPUT_PULLUP); // assuming you're using pull-up resistors
}
Keyboard.begin();
Serial.begin(9600);
}
void loop() {
int m = digitalRead(6);
int l = digitalRead(3);
int r = digitalRead(7);
if (m == LOW) {
Keyboard.write(KEYPAD_5);
delay(299);
} else if (l == LOW) {
Keyboard.write(KEYPAD_3);
delay(299);
} else if (r == LOW) {
Keyboard.write(KEYPAD_6);
delay(299);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment