// Teamskeyboard Uses ATTiny85 with some hardware keys to send Teams Hotkeys // frank@carius.de www.mxxfaq.de #include "DigiKeyboard.h" #define SW1_PIN 0 // Pin with Switch 1 #define LED_PIN 1 // Model A uses PIN1, ModelB uses PIN0 int SW_debounce = 100; // used to handle switch trigger void setup() { // initialize the digital pin as an output. pinMode(LED_PIN, OUTPUT); //LED on Model A pinMode(SW1_PIN, INPUT_PULLUP); // Set input with Pullup } void loop() { // endless main routine if (digitalRead(SW1_PIN) == LOW){ if (SW_debounce > 0) { SW_debounce--; //debounce-logic Decrement Counter down to 0 } if (SW_debounce == 1){ // debounce-logic Send key once if 1 but not of lower digitalWrite(LED_PIN, HIGH); // set signal LED to show switch status //DigiKeyboard.println("SendKey"); //DigiKeyboard.sendKeyStroke(0); // Prevents sometimes missing the first keystroke DigiKeyboard.sendKeyStroke(KEY_M , MOD_CONTROL_LEFT + MOD_SHIFT_LEFT); // Ctrl-Shift-M DigiKeyboard.delay(50); // Wait a short time } else { DigiKeyboard.delay(100); // Wait before rechecking key status } } else { // key not pressed and reset debounce counter // DigiKeyboard.println("HIGH"); digitalWrite(LED_PIN, LOW); SW_debounce = 5; // Reset key Countdown to 5 DigiKeyboard.delay(100); // Wait before rechecking key status } }