Skip to content

Instantly share code, notes, and snippets.

@koyamalmsteen
Last active June 15, 2021 02:48
Show Gist options
  • Save koyamalmsteen/4e5b845e796d522b5a101d8c9f4f5304 to your computer and use it in GitHub Desktop.
Save koyamalmsteen/4e5b845e796d522b5a101d8c9f4f5304 to your computer and use it in GitHub Desktop.
#include <Keyboard.h>
//
// This program is for Google Chrome with DagikEarth
// https://gist.github.com/koyamalmsteen/4e5b845e796d522b5a101d8c9f4f5304
//
#define ButtonForward 8
#define ButtonBack 9
void setup() {
Keyboard.begin();
pinMode(ButtonForward, INPUT_PULLUP);
pinMode(ButtonBack, INPUT_PULLUP);
}
void loop() {
/*
* Move to Next Tab
*/
if(digitalRead(ButtonForward) == LOW){
delay(20); // to stay away chattering, wait for 20ms.
Keyboard.press(KEY_LEFT_CTRL);
Keyboard.press(KEY_TAB);
delay(100);
Keyboard.releaseAll();
while(digitalRead(ButtonForward) == LOW);
}
/*
* Move to Previous Tab
*/
if(digitalRead(ButtonBack) == LOW){
delay(20); // to stay away chattering, wait for 20ms.
Keyboard.press(KEY_LEFT_CTRL);
Keyboard.press(KEY_LEFT_SHIFT);
Keyboard.press(KEY_TAB);
delay(100);
Keyboard.releaseAll();
while(digitalRead(ButtonBack) == LOW);
}
delay(100);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment