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
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.
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?
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.
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.