A project that I wanted to get started with for a long time: A hardware button that would allow me to mute and unmute myself on zoom. Additionally it should have a smaller enable/disable video button (I rarely use video). The easiest route is sending the keyboard shortcut (which you have to enable globally if you want to use it while zoom is in the background). This comes with the downside, that you don’t have any feedback from the app – once it’s out of sync, you will need to manually click the button again. But that is acceptable for me, as I intend to use only the button.
The testing-hardware consists of a Arduino Leonardo, two simple buttons and a WS2812b strip. The final version will use a Arduino Micro Pro, which is much smaller and still works flawlessly as a HID device. Because a great HID library exists already, there is very little code needed to make this work.
Picture of the physical prototype Zoom button
The (unfinished) code
#include <Arduino.h>
#include "HID-Project.h"
#define LAYOUT_GERMAN
#include "Ticker.h"
#include <Adafruit_NeoPixel.h>
const int pinLed = LED_BUILTIN;
const int pinButtonAudio = 2;
bool audioMuted;
void getButtons();
Ticker tickerObject(getButtons, 300);
Adafruit_NeoPixel strip(4, 7, NEO_GRB + NEO_KHZ800);
uint32_t red = strip.Color(255, 0, 0); // Red
uint32_t green = strip.Color(0, 255, 0); // Green
uint32_t blue = strip.Color(0, 0, 255); // Blue
void setup() {
pinMode(pinLed, OUTPUT);
pinMode(pinButtonAudio, INPUT_PULLUP);
// Sends a clean report to the host. This is important on any Arduino type.
Keyboard.begin();
strip.begin();
strip.show();
strip.fill(blue);
strip.setBrightness(90);
strip.show();
audioMuted = true;
tickerObject.start(); //start the ticker.
}
void loop() {
tickerObject.update();
}
void getButtons() {
if (!digitalRead(pinButtonAudio)) {
digitalWrite(pinLed, HIGH);
Keyboard.press(KEY_LEFT_ALT);
//Keyboard.press(KEY_LEFT_CTRL);
Keyboard.press(KEY_A);
Keyboard.releaseAll();
strip.clear();
audioMuted = !audioMuted;
if(audioMuted) {
strip.fill(red);
} else {
strip.fill(green);
}
strip.show();
digitalWrite(pinLed, LOW);
}
}
Leave A Comment