Program the Elegoo Smart Robot Car Kit V4.0 with VScode
I'm new to Arduino programming, so it took me a while to get my development environment working. Also, the files and documentation for this particular robot aren't that intuitive. There are a lot of different versions of the code floating around (also on the official site). And the design of the manual makes it hard to read.
This robot has two chips/boards to program: the Arduino R3 uno and the ESP32-S3 WROOM in my case. There is also a version with a different ESP32 chip! My goal was to use VScode to program both the Arduino and the ESP32. Which in the end kind of works.
Set up environment
- Ubuntu 24.04
- VScode 1.102.x (at this moment)
Arduino
- Install Arduino CLI (https://docs.arduino.cc/arduino-cli/installation/ or https://arduino.github.io/arduino-cli/1.2/installation/):
curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | BINDIR=~/arduino/bin sh
- Add install path to
PATH
in~/.bashrc
:
#Arduino
export PATH=/home/joep/arduino/bin:$PATH
- Reload terminal:
source ~/.bashrc
- Install board libraries:
arduino-cli config init
arduino-cli core update-index
arduino-cli core install arduino:avr
- Install Arduino Community Extension in VScode: https://marketplace.visualstudio.com/items?itemName=vscode-arduino.vscode-arduino-community
- Install C++ extension: https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools
ESP32
- Install board libraries:
arduino-cli config add board_manager.additional_urls https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
arduino-cli core update-index
arduino-cli core install esp32:esp32
Setup repository
Get source code
There is a Github page, but it doesn't have the latest code. Currently the latest change is from 2021.
The product page with software version v1.3:

The download page where I found software version v1.4 (STEM kits – Robot Kits – Smart Robot Car Kit V4.0):

Install libraries
- Unzip the source code to a local folder.
- From folder
ELEGOO Smart Robot Car Kit V4.0 2024.01.30/03 Tutorial & Code/01 SmartRobotCarV4.0_Preparation/addLibrary
unzip the.zip
files to/home/joep/arduino/libraries
. - Not sure if this step is needed. Import them into library:
arduino-cli lib install Adafruit_BusIO
arduino-cli lib install Adafruit_GFX_Library
arduino-cli lib install Adafruit_SSD1306
arduino-cli lib install FastLED
arduino-cli lib install I2Cdev
arduino-cli lib install IRremote
arduino-cli lib install NewPing
arduino-cli lib install pitches
arduino-cli lib install Servo
Directory structure
.
├── .vscode
│ └── settings.json
├── arduino-uno
│ ├── .vscode
│ │ ├── arduino.json
│ │ ├── c_cpp_properties.json
│ │ └── settings.json
│ ├── build
│ ├── arduino-uno.ino
│ ├── DeviceDriverSet_xxx0.cpp
│ ├── DeviceDriverSet_xxx0.h
│ ├── LedControl.cpp
│ ├── LedControl.h
│ ├── MPU6050_getdata.cpp
│ ├── MPU6050_getdata.h
│ ├── MPU6050.cpp
│ ├── MPU6050.h
│ ├── README.md
│ ├── RobotControl.cpp
│ └── RobotControl.h
├── esp32s3
│ ├── .vscode
│ │ ├── arduino.json
│ │ ├── c_cpp_properties.json
│ │ └── settings.json
│ ├── build
│ ├── esp32s3.ino
│ └── README.md
└── .gitignore
There are a few things that took me some time to get right. I guess some things you just have to learn.
- In VScode you can only select a single board. So you can either run IntelliSense, check and build the code for Arduino Uno or run it for ESP32. I tried PlatformIO, which promised to support developing both, but that had other issues. I couldn't get the ESP code build and uploaded properly. It just wouldn't run.
- To work around this issue, I create separate directories for both boards. A minor disadvantage is that I now need to open two separate VScode instances.
- The
.ino
file needs to have the exact same name as the directory it's in. Soarduino-uno.ino
is in directoryarduino-uno
,esp32s3.ino
is in directoryesp32s3
.
Configure boards
- Check board:
CTRL+SHIFT+P
– "Arduino: Board config"- For Arduino select "Arduino Uno (Arduino AVR Boards)"
- For ESP32 select "ESP32S3 Dev Module (esp32)" with configuration:
- PSRAM: "OPI PSRAM"
- Flash Mode: "QIO 80MHz"
- Flash Size: "8MB (64Mb)"
- USB CDC On Boot: "Enabled"
- Partition Scheme: "8M with spiffs (3MB APP/1.5MB SPIFFS)"
- Upload speed: "921600"
- Check library:
CTRL+SHIFT+P
– "Arduino: Library manager" – Check if all Elegoo libraries are installed (the ones added manually earlier). - Check serial port:
- My Arduino is on
ls -la /dev/ttyUSB*
– update inarduino-uno/.vscode/arduino.json
- My Arduino is on
{
"sketch": "arduino-uno.ino",
"board": "arduino:avr:uno",
"port": "/dev/ttyUSB0",
"output": "build"
}
- My ESP32 is on
ls -la /dev/ttyACM*
– update inesp32s3/.vscode/arduino.json
{
"sketch": "esp32s3.ino",
"board": "esp32:esp32:esp32s3",
"port": "/dev/ttyACM0",
"output": "build",
"configuration": "JTAGAdapter=default,PSRAM=opi,FlashMode=qio,FlashSize=8M,LoopCore=1,EventsCore=1,USBMode=hwcdc,CDCOnBoot=cdc,MSCOnBoot=default,DFUOnBoot=default,UploadMode=default,PartitionScheme=default_8MB,CPUFreq=240,UploadSpeed=921600,DebugLevel=none,EraseFlash=none,ZigbeeMode=default"
}
CTRL+SHIFT+P
– "Arduino: Rebuild IntelliSense configuration"
Quirks
- The Elegoo software only builds when you use version 2.0.14 of the ESP board libraries. When you start from scratch with your own, go ahead and install the latest version.

- Because some/not all/most of the ESP32 libraries aren't properly formatted as Arduino libraries, IntelliSense gets confused. It will mark includes as "not found", but the code will compile just fine. From Github Copilot:
Note:
When using the Arduino extension for Visual Studio Code with ESP32 boards, IntelliSense may show false errors such as missing ESP-IDF headers (freertos/FreeRTOS.h
,soc/soc_caps.h
, etc.).
This is a known limitation due to the way the Arduino extension generates include paths and the ESP32 Arduino core’s use of ESP-IDF internally.Workarounds (none are perfect):
- Code will still compile and upload correctly.
- You can disable error squiggles in VS Code settings for less distraction:
"C_Cpp.errorSquiggles": "Disabled"
- For best IntelliSense, consider using PlatformIO or native ESP-IDF development.
For most Arduino ESP32 projects, these errors can be safely
- My workaround if I really need it (won't survive compiling):
- Copy this line
"/home/joep/.arduino15/packages/esp32/tools/esp32-arduino-libs/idf-release_v5.4-858a988d-v1/esp32s3/include/**"
in the"includePath"
array inc_cpp_properties.json
. - IntelliSense can now find all the ESP32 libraries.
- However, on (re)build IntelliSense will overwrite this file and delete the added line.
- Copy this line