Go Down

Topic: ESP32 output voltage on input pin (Read 904 times) previous topic - next topic

Damien98

Hi, I'm working on an ESP32 (Heltec) project and i'm facing this issue with GPIO4: when I set it as output it works fine but when I set it as input there's 3.3V on this pin, I need to read the voltage with analogRead() and the 3.3V of this pin change the real value. It seems like there's an internal pull-up resistor enabled.

Here's my easy code:

Code: [Select]
void setup() {
  Serial.begin(9600);
  pinMode(4,INPUT);
}

void loop() {
  Serial.println(analogRead(4));
  delay(1000);
}

BJHenry

Since you mention Heltec, I assume you are using either the Wifikit32 or the WifiLoRa32. On both of these boards GPIO4 is the SDA line for the onboard OLED, and it has a hardware pullup resistor.

Go Up