0
\$\begingroup\$

Here is my code:

#define LED_BUILTIN 12
void setup() 
{
 
 pinMode(LED_BUILTIN, OUTPUT);
}
void loop() 
{
 digitalWrite(LED_BUILTIN, HIGH); 
 delay(1000); 
 digitalWrite(LED_BUILTIN, LOW);
 delay(1000); 
}

The above code works perfectly fine for GPIO_2 but fails for GPIO_12. Is it giving a fault because I am using a touchpad pin or there is some other error?

I have attached an LED to GPIO_12 of the ESP32. After uploading the program, my LED is not blinking. I have tried to connect voltmeter to GPIO_12 and it is giving 0.5 volts with minor fluctuation. I was expecting a change of voltage after each second as per HIGH/LOW conditions of my code but unfortunately, I am not getting the desired result. What could be the possible reason?

JRE
75k10 gold badges115 silver badges197 bronze badges
asked Dec 5, 2022 at 13:45
\$\endgroup\$
4
  • \$\begingroup\$ That would depend on which exact ESP32 module you have and what else is connected on that pin. \$\endgroup\$ Commented Dec 5, 2022 at 13:50
  • \$\begingroup\$ how are you connecting the LED to GPIO_12? \$\endgroup\$ Commented Dec 5, 2022 at 14:19
  • \$\begingroup\$ Exactly, now I have found out the solution. The code for which I was following the reference website contained 36 pins which mean 18 pins on each side but in my version of the board there were total 30 pins on my board which mean 15 pins on each side. Now that I have manual of that board, everything is fine, aligned and makes perfect sense anyways, Thanks. \$\endgroup\$ Commented Dec 5, 2022 at 14:19
  • \$\begingroup\$ @Paul Ghobril, I was connecting it through 220 ohms resistor. Anyways, that was not the issue in my case and I have got the answer and posted it below in answer section. \$\endgroup\$ Commented Dec 5, 2022 at 14:25

1 Answer 1

1
\$\begingroup\$

Now I have found out the solution so let's share so that others can also get benefit. The code for which I was following the reference website contained 36 pins which mean 18 pins on each side but in my version of the board there were total 30 pins on my board which mean 15 pins on each side. Now that I have got pin out reference of that board and my board also, everything is fine, aligned and makes perfect sense. Problem was that the hardware which the reference website referred to had different hardware version with 36 pins and my hardware contained 30 total pins and was a different version of ESP32.

answered Dec 5, 2022 at 14:22
\$\endgroup\$
2
  • 1
    \$\begingroup\$ So, in short, you toggled GPIO 12 but accidentally had been measuring a wrong pin? \$\endgroup\$ Commented Dec 5, 2022 at 14:39
  • \$\begingroup\$ No, I was toggling GPIO 26 but was mistaken that I was toggling GPIO12 due to following wrong ESP32 devkit version pinout diagram. When I used the right board version pinout diagram which matched with my board hardware, everything got ok. \$\endgroup\$ Commented Dec 5, 2022 at 15:22

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.