/*
Arduino | general
biiiiiiiiiiiiiiiscuuuuuuuuuuuuit
8/30/25 — 2:31 PM
since I had this idea for like the voltage controlled osc synth
where there is one button and one potentiometer
the potentiometer controls some specific control
and when you click the button it starts controlling something else
so maybe like pitch, wave shape, volume as the three modes
*/
const int BTN_PIN = 12;
const int POT_PIN = A0;
const char MODE_NAME[][16] = {
{"Pitch"},
{"Wave shape"},
{"Volume"}
};
int mode = -1;
int oldMode = -1;
int oldBtnState = 1; // pin idles HIGH with pullup
void checkButton() {
int btnState = digitalRead(BTN_PIN); // read the pin
if (btnState != oldBtnState) { // if it changed
oldBtnState = btnState; // remember the state
if (btnState == LOW) { // was just pressed
//Serial.println("Button Pressed");
mode++;
if (mode == 3) mode = 0;
} else { // was just released
//Serial.println("Button Released");
}
delay(20); // short delay to debounce button
}
}
void setup() {
Serial.begin(115200);
pinMode(BTN_PIN, INPUT_PULLUP);
}
void loop() {
checkButton();
if (mode != oldMode) {
oldMode = mode;
Serial.print("Mode: ");
Serial.println(MODE_NAME[mode]);
}
}