How can I use pins Ax as digital?


I’m trying to use analogs pins A2, A3, and A0 in ESP32 DevKit V1 as digital pins (to blink three LEDs in my project), but I’m not having success.

I thought that I only need to do this:



But for some reason, it doesn’t work. Is there some special configuration to Ax pins acts as digital? I can’t choose other pins because I have PCB design constraints.

Thanks all.

Hi @Nysix
D34, D35, D36, D39 are only input pins in all esp32 devices.
I tested A0 pin for instance and worked fine.
Let me know if things are still unclear.


# loop forever
while True:
    digitalWrite(A0, HIGH)  # turn the LED ON by setting the voltage HIGH
    sleep(100)               # wait for a second
    digitalWrite(A0, LOW)   # turn the LED OFF by setting the voltage LOW
    sleep(100)               # wait for a second

Hi karimhamdy,

Interesting, I can’t get the same results here. :neutral_face: But as input-only pins, I realize that I need to change the PCB.