Button is always low?

//ESP32

const int switchStartStopPin = 25;

typedef enum SWITCH
{
  SWITCH_NONE,
  SWITCH_1,
  SWITCH_2
} switch_t;

switch_t readSwitch(void)
{
  int switchAdcValue = 0;
  // Switch connected directly to individual separate pins
  if (digitalRead(switchStartStopPin) == LOW) return SWITCH_1;
  Serial.println("Switch 1 pressed");
  if (digitalRead(switchLfPbPin) == LOW) return SWITCH_2;

  return SWITCH_NONE;
}

What am I missing?

The code tags that I added for you?...
The schema of how things are wired and powered?
The rest of the code?

The rest of your code.
A clear description of your problem.
A schematic

Are just three of the things that come to mind

how is it wired? as you don't set the pins, they are just INPUT. do you have an external pull-up or pull-down resistor?

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.