Program the Elegoo Smart Robot Car Kit V4.0 with VScode

Coding Jul 23, 2025

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

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

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.

GitHub - elegooofficial/ELEGOO-Smart-Robot-Car-Kit-V4.0: ELEGOO Smart Robot Car Kit V4.0
ELEGOO Smart Robot Car Kit V4.0. Contribute to elegooofficial/ELEGOO-Smart-Robot-Car-Kit-V4.0 development by creating an account on GitHub.

The product page with software version v1.3:

ELEGOO Smart Robot Car Kit V4.0 Tutorial
Click to download: 1.Download manual + tutorial + code + App + datasheets all in 1 package: ELEGOO Smart Robot Car Kit V4.0 - link 1 ELEGOO Smart Robot Car Kit V4.0 - link 2-Google Drive 2.Download manual / tutorial / code / App / datasheets seperately from different folders: ELEGOO Smart Robot Car Kit V4.0 3.Manual Bo

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

ELEGOO 3D Printers, Arduino Kits & Robots Tutorials Download
Knowledge Base DOWNLOAD EVERYTHING YOU NEED You can select the section corresponding to the product you purchased and download all the related files. 3D Printer Trouble shooting Visit this blog for continuously updated support articles about our 3d printer products. Read All Still have questions? If you have any questi

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. So arduino-uno.ino is in directory arduino-uno, esp32s3.ino is in directory esp32s3.

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 in arduino-uno/.vscode/arduino.json
{
    "sketch": "arduino-uno.ino",
    "board": "arduino:avr:uno",
    "port": "/dev/ttyUSB0",
    "output": "build"
}
    • My ESP32 is on ls -la /dev/ttyACM* – update in esp32s3/.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 in c_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.

Tags