Hi Makers,
I am please to share with you my latest project... a "console" to simplify my life when I need to create and edit a video. Actually I configured all the buttons for the software Davinci Resolve, as the Arduino Pro micro (Arduino Leonardo is mandatory ) is emulated a Keyboard, you can adapt yours for any software or needs...
4 buttons for:
Select
Cut
STOP
Play
BOM
What you will need:
1 Arduino Pro Micro (Leonardo)
1 encoder KY-040
4 buttons 12mm x 12mm
4 Buttons cap
6 FHC M3x8mm screws
4 LED 5mm (not mandatory)
ADUINO Pro micro code
The Arduino Pro Micro has been created with a generative AI: Be careful, I am using an AZERTY keyboard, change the ASCII code for another landscape (yellow)
#include
// Définition des broches
const int buttonA = 9; // Bouton "A" (AZERTY -> 'q')
const int buttonB = 8; // Bouton "B"
const int buttonK = 7; // Bouton "K" (nouveau)
const int buttonL = 6; // Bouton "L" (nouveau)
const int encoderDT = 5; // DT du KY-040
const int encoderCLK = 4; // CLK du KY-040
int lastStateCLK; // État précédent de CLK pour détecter la rotation
// Variables pour mémoriser l'état des boutons
bool buttonAState = HIGH; // État actuel du bouton "A"
bool buttonBState = HIGH; // État actuel du bouton "B"
bool buttonKState = HIGH; // État actuel du bouton "K"
bool buttonLState = HIGH; // État actuel du bouton "L"
void setup() {
pinMode(buttonA, INPUT_PULLUP); // Bouton "A"
pinMode(buttonB, INPUT_PULLUP); // Bouton "B"
pinMode(buttonK, INPUT_PULLUP); // Bouton "K"
pinMode(buttonL, INPUT_PULLUP); // Bouton "L"
pinMode(encoderDT, INPUT_PULLUP); // Encodeur DT
pinMode(encoderCLK, INPUT_PULLUP); // Encodeur CLK
// Lecture initiale de CLK
lastStateCLK = digitalRead(encoderCLK);
// Initialisation de l'émulation clavier
Keyboard.begin();
}
void loop() {
// Lecture des boutons
bool currentButtonAState = digitalRead(buttonA);
bool currentButtonBState = digitalRead(buttonB);
bool currentButtonKState = digitalRead(buttonK);
bool currentButtonLState = digitalRead(buttonL);
// Bouton "A" : envoie une seule fois la touche "q" (AZERTY)
if (currentButtonAState == LOW && buttonAState == HIGH) { // Détection de la pression
Keyboard.press(0x71); // Code ASCII pour 'q'
delay(50); // Anti-rebond
Keyboard.release(0x71);
}
buttonAState = currentButtonAState; // Mémorise l'état
// Bouton "B" : envoie une seule fois la touche "b"
if (currentButtonBState == LOW && buttonBState == HIGH) { // Détection de la pression
Keyboard.press(0x62); // Code ASCII pour 'b'
delay(50); // Anti-rebond
Keyboard.release(0x62);
}
buttonBState = currentButtonBState; // Mémorise l'état
// Bouton "K" : envoie une seule fois la touche "k"
if (currentButtonKState == LOW && buttonKState == HIGH) { // Détection de la pression
Keyboard.press(0x6B); // Code ASCII pour 'k'
delay(50); // Anti-rebond
Keyboard.release(0x6B);
}
buttonKState = currentButtonKState; // Mémorise l'état
// Bouton "L" : envoie une seule fois la touche "l"
if (currentButtonLState == LOW && buttonLState == HIGH) { // Détection de la pression
Keyboard.press(0x6C); // Code ASCII pour 'l'
delay(50); // Anti-rebond
Keyboard.release(0x6C);
}
buttonLState = currentButtonLState; // Mémorise l'état
// Gestion de l'encodeur rotatif
int currentStateCLK = digitalRead(encoderCLK);
if (currentStateCLK != lastStateCLK) { // Rotation détectée
if (digitalRead(encoderDT) != currentStateCLK) {
// Rotation horaire -> CTRL + +
Keyboard.press(KEY_LEFT_CTRL); // Maintenir CTRL
Keyboard.press(KEY_LEFT_SHIFT); // Maintenir SHIFT pour '+'
Keyboard.press(0x3D); // Code ASCII pour '='
delay(50); // Anti-rebond
Keyboard.release(0x3D); // Relâcher '='
Keyboard.release(KEY_LEFT_SHIFT); // Relâcher SHIFT
Keyboard.release(KEY_LEFT_CTRL); // Relâcher CTRL
} else {
// Rotation antihoraire -> CTRL + -
Keyboard.press(KEY_LEFT_CTRL); // Maintenir CTRL
Keyboard.press(0x2D); // Code ASCII pour '-'
delay(50); // Anti-rebond
Keyboard.release(0x2D); // Relâcher '-'
Keyboard.release(KEY_LEFT_CTRL); // Relâcher CTRL
}
}
lastStateCLK = currentStateCLK; // Mémoriser l'état précédent de CLK
}
3D Files
All the 3D SOLIDWORKS (2025x) projet is available here, feel free to enhance it!