• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

LED 2 not blinking in simple Blink_LED demo in module 1 of Build Web Servers

Q&A Forum › Category: ESP32 › LED 2 not blinking in simple Blink_LED demo in module 1 of Build Web Servers
0 Vote Up Vote Down
Joe Margevicius asked 4 years ago

Embarrassingly, I’m not a beginner programmer (but haven’t used the Visual Studio Code IDE before), but am starting the “Build Web Servers with ESP32 and ESP8266” book. Going thru Module 1, after installing Visual Studio Code, creating a new project, creating the main.cpp file to blink LED 2 on an ESP32-WROOM-32 board (tried it also on an ESP8266MOD board, selecting several different boards in the drop-down), and doing Run/Start Debugging, it compiles fine, looks like it writes to flash fine (says “Success”), but the LED 2 is not blinking (I tried another pin with an LED on it, changing code, and same problem- not blinking) …. it’s as if there is a “run” button I’m not pushing, after a compile (same issue if I do Run/Run without debugging).  (I did a total flash erase, and tried again – no change).  I must be doing something really dumb … any ideas?  Thanks

5 Answers
0 Vote Up Vote Down
Steve Mercer answered 4 years ago

First, try pushing the reset button on the board(s).
 
If that doesn’t work, then try one of the examples. I don’t recall if all of the examples came with the download of PIO so, if you don’t have them, try downloading them from https://github.com/platformio/platform-espressif32/archive/develop.zip. Once you have unzipped them into your projects directory you should see an arduino-blink directory. The Blink.cpp uses LED_BUILTIN which should work for the board you are using (I know it does for all of my boards). If you look at your platform.ini file you should see build flags that set LED_BUILTIN=2.
 
If that still doesn’t work then maybe your specific board does not have an onboard LED. Try connecting an external LED with a resistor and see if that works.

0 Vote Up Vote Down
Sara Santos Staff answered 4 years ago

Hi Joe.
After uploading the code, have you tried pressing the on-board RESET button?
In some boards, you need to press the RESET button so it starts running the code.
What is exactly the ESP32 board that you have? Can you share a link to your board?
Regards,
Sara

0 Vote Up Vote Down
Joe Margevicius answered 4 years ago

I got it blinking — I was confused by the “Run” tab at the top of Visual Studio Code, invoking Run/Start Debugging, and seeing “success”.  It apparently is not really a “run” function (unless you think compiling code is a “run” function).  I found the upload arrow at the bottom of the screen, and that did it … I’ve used IDEs built around microcontrollers, like CCS for TI MSP430s, and so was expecting an important function like getting the code to run on a target to be front and center (even Thonny and Adruino IDE were less cryptic). Thank you Sara and Steve for working with me.

0 Vote Up Vote Down
Sara Santos Staff answered 4 years ago

Hi Joe.
In some of my boards, the code starts working if I open the Serial Monitor in VS Code.
In other, I have to press the RST button.
I’ll mark this issue as resolved.
If you need further help, you just need to open a new question in our forum.
Regards,
Sara

0 Vote Up Vote Down
Joe Margevicius answered 4 years ago

Thanks Sara … the issue was that VS Code was not writing to the chip, so hitting the RST button did nothing, nor did opening the terminal.  Finding that Upload function finally wrote to flash.

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition April 16, 2025
  • [eBook Updated] Learn ESP32 with Arduino IDE eBook – Version 3.2 April 16, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.