const int buttonPin = 18; // GPIO pin connected to the push button
const int potPin = 34; // ADC pin connected to the potentiometer
int buttonState = 0;
int lastButtonState = LOW;
int pedalCount = 0;
int potValue = 0;
void setup() {
pinMode(buttonPin, INPUT);
Serial.begin(115200);
}
void loop() {
// Read the push button state
buttonState = digitalRead(buttonPin);
// Count button presses
if (buttonState == HIGH && lastButtonState == LOW) {
pedalCount++;
Serial.print("Pedal Count: ");
Serial.println(pedalCount);
}
lastButtonState = buttonState;
// Read the potentiometer value
potValue = analogRead(potPin);
Serial.print("Potentiometer Value: ");
Serial.println(potValue);
delay(100); // Small delay to make the output readable
}