Hello,
I'm new to the arduino world, and I am currently running into a issue. The issue is when the switch is pressed, I get a very sporadic response, if at all. My long term goal will be to have a simple foot pedal, which will sent "CTRL", to use with discord and activate the mic. Any help I can get would be great.
Setup:
1 Leonardo Pro Micro
1 Micro Switch (Com to GRD, and NO to Pin 2 on Pro Micro)
#include <Keyboard.h>
const int buttonPin = 2;
void setup() {
pinMode(buttonPin, INPUT);
Keyboard.begin();
delay(1000);
}
int buttonState = 0;
int key = 'n';
void loop() {
buttonState = digitalRead(buttonPin);
if (buttonState == HIGH) {
Keyboard.press(key);
} else if (buttonState == LOW) {
Keyboard.releaseAll();
}
delay(100);
}