Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <ProTrinketKeyboard.h>
- const int PIN_1 = 0;
- const int PIN_2 = 1;
- const int PIN_3 = 3;
- const int PIN_4 = 5;
- const int PIN_5 = 4;
- const int PIN_6 = 8;
- const int PIN_7 = 6;
- const int MINRELEASETIME = 19;
- void setup() {
- pinMode(PIN_1, INPUT_PULLUP);
- pinMode(PIN_2, INPUT_PULLUP);
- pinMode(PIN_3, INPUT_PULLUP);
- pinMode(PIN_4, INPUT_PULLUP);
- pinMode(PIN_5, INPUT_PULLUP);
- pinMode(PIN_6, INPUT_PULLUP);
- pinMode(PIN_7, INPUT_PULLUP);
- TrinketKeyboard.begin();
- }
- void loop() {
- TrinketKeyboard.poll();
- if (digitalRead(PIN_1) == LOW) {
- clear_keys();
- TrinketKeyboard.pressKey(0, KEYCODE_F5); //run
- end_keypress();
- } else if (digitalRead(PIN_2) == LOW) {
- clear_keys();
- TrinketKeyboard.pressKey(KEYCODE_MOD_LEFT_SHIFT, KEYCODE_F5); //stop debugging
- end_keypress();
- } else if (digitalRead(PIN_3) == LOW) {
- clear_keys();
- TrinketKeyboard.pressKey(KEYCODE_MOD_LEFT_SHIFT | KEYCODE_MOD_LEFT_CONTROL, KEYCODE_F5); //restart debugging
- end_keypress();
- } else if (digitalRead(PIN_4) == LOW) {
- clear_keys();
- TrinketKeyboard.pressKey(KEYCODE_MOD_LEFT_CONTROL, KEYCODE_B); //build
- end_keypress();
- } else if (digitalRead(PIN_5) == LOW) {
- clear_keys();
- TrinketKeyboard.pressKey(0, KEYCODE_F10); //step over
- end_keypress();
- } else if (digitalRead(PIN_6) == LOW) {
- clear_keys();
- TrinketKeyboard.pressKey(0, KEYCODE_F11); //step into
- end_keypress();
- } else if (digitalRead(PIN_7) == LOW) {
- clear_keys();
- TrinketKeyboard.pressKey(KEYCODE_MOD_LEFT_SHIFT, KEYCODE_F11); //step out of
- end_keypress();
- }
- delay(100);
- }
- void wait() {
- for (int i = 0; i < MINRELEASETIME/10; i++) {
- delay(10);
- TrinketKeyboard.poll();
- return;
- }
- }
- void clear_keys() {
- TrinketKeyboard.pressKey(0, 0);
- return;
- }
- void end_keypress() {
- clear_keys();
- wait();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement