-
Notifications
You must be signed in to change notification settings - Fork 2
/
Microsoft_Teams_Mic_Mute_Button.ino
41 lines (34 loc) · 1.09 KB
/
Microsoft_Teams_Mic_Mute_Button.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// Based on the code of JH Jeong (https://www.thingiverse.com/thing:3551855)
#include <HID.h>
#include <Keyboard.h>
// Connect switch between PIN8 and GND.
const int switch_pin = 8;
int button_state = 0;
int previous_button_state = HIGH;
long last_debounce_time = 0;
const long debounce_delay = 50;
void setup()
{
pinMode(switch_pin,INPUT_PULLUP);
digitalWrite(switch_pin, HIGH);
Keyboard.begin();
}
void loop()
{
button_state = digitalRead(switch_pin);
if ((button_state != previous_button_state) && (button_state == HIGH))
{
if ((millis() - last_debounce_time) > debounce_delay)
{
// Keyboard shortcuts for Microsoft Teams: https://support.microsoft.com/en-us/office/keyboard-shortcuts-for-microsoft-teams-2e8e2a70-e8d8-4a19-949b-4c36dd5292d2
// Use KEY_LEFT_GUI on Mac and KEY_LEFT_CTRL on Windows.
Keyboard.press(KEY_LEFT_CTRL);
Keyboard.press(KEY_LEFT_SHIFT);
Keyboard.press('m');
delay(100);
Keyboard.releaseAll();
last_debounce_time = millis();
}
}
previous_button_state = button_state;
}