Lesson 01: Serial Output "Hello World"¶
Compatible development boards: CrowPanel Advanced 7 / 9 / 10.1-inch ESP32-P4 HMI AI Display Development Boards
Model compatibility: The software code and primary interface definitions are common across the 7-inch, 9-inch, and 10.1-inch models; only their physical dimensions differ. This lesson requires no screen-size-specific code modifications.
1. Course Objectives¶
In this lesson, you will complete the initial configuration of the Arduino IDE, create and upload your first ESP32-P4 project, and then use the UART0 serial monitor to output Hello World! once per second.
After completing this lesson, you should be able to:
- Install and verify the ESP32 Arduino Core.
- Correctly select
ESP32P4 Dev Module, the serial port, and the P4 upload parameters. - Distinguish
setup(), which runs only once, fromloop(), which runs continuously. - Complete verification and upload, and view serial output at a baud rate of 115200.
- Identify common issues based on compilation, upload, and serial messages.
2. Preparation¶
- Arduino IDE 2.x. The screenshots in this lesson use Arduino IDE 2.3.x; other compatible 2.x versions operate essentially the same.
- ESP32 Arduino Core 3.3.3, or a compatible version specified by the course package. If the course package specifies a version explicitly, follow the course package.
- One CrowPanel Advanced 7 / 9 / 10.1-inch ESP32-P4 HMI AI Display development board.
- One USB-C cable that supports data transfer; a power-only cable cannot upload programs.
- This lesson requires no external modules; the project folder need only contain the
.inofile that shares the folder's name.
Code reference link: https://github.com/Elecrow-RD/CrowPanel-Advanced-7inch-ESP32-P4-HMI-AI-Display-1024x600-IPS-Touch-Screen/tree/master/example
3. First-Time Project Configuration¶
On first use, complete the configuration in the order described in this section. First confirm the development environment and project, then connect the hardware, select the board and port, and finally compile and upload.
3.1 Confirm the Arduino IDE Version¶
Launch the Arduino IDE and open Help > About Arduino IDE to confirm you are using Arduino IDE 2.x. The version number shown in the screenshots is for demonstration only and does not need to match the screenshots exactly.
Software installation: Download_Arduino_IDE - Elecrow Wiki
3.2 Install the ESP32 Board Support Package¶
After the installation is completed, open the Arduino IDE. First, randomly open a project.
Go to "Preferences"
Configure "Additional Boards Manager URLs"
Add this in
https://adafruit.github.io/arduino-board-index/package_adafruit_index.json
Remember to save!
- Click Board Manager on the left sidebar.
- Search for
esp32. - Find esp32 by Espressif Systems, select the version required by the course, and install it.
- After installation completes, close the Board Manager; if the corresponding version already shows as
installed, there is no need to reinstall.
The reference image shows the Board Manager entry point, search, and version status. For this P4 lesson, install version 3.3.3.
3.3 Create or Open the Complete Project¶
In the Arduino IDE, select File > New Sketch and save it as Lesson01-Print_Hello_World; alternatively, you can directly open Lesson01-Print_Hello_World.ino from the course code.
An Arduino sketch requires the project folder name to match the main .ino file name. For example:
If the IDE prompts you to automatically create a folder with the same name, confirm and proceed.
Write the following code into the sketch and save:
void setup() {
Serial.begin(115200);
}
void loop() {
Serial.print("Hello World!\r\n");
delay(1000);
}
3.4 Connect the Board Using UART0¶
Connect a USB-C cable that supports data transfer to the port labeled UART0 on the development board, then connect it to your computer.
Important: Arduino programs are uploaded via UART0.
UART3-INis used only for external power or general serial communication and cannot replace UART0 for flashing the program.
3.5 Select the Board and Port¶
Open Tools > Board > esp32 and select ESP32P4 Dev Module.
Then open Tools > Port and select the COM port that newly appears after connecting the board. If you cannot determine which port it is, unplug the data cable to observe which port disappears, then reconnect and select the port that reappears.
3.6 Verify the Upload Parameters¶
In the Tools menu, verify the following items one by one:
- Board:
ESP32P4 Dev Module - Core Debug Level:
Info - Flash Frequency:
80MHz - Flash Mode:
QIO - Flash Size:
16MB (128Mb) - Partition Scheme:
16M Flash (3MB APP/9.9MB FATFS) - PSRAM:
Enabled - Upload Mode:
UART0 / Hardware CDC - USB Mode:
Hardware CDC and JTAG - Port: the actual
COMport corresponding to the board
3.7 Import the Library Files We Need to Use¶
Open File > Preferences and note the "Sketchbook location".
Close the Arduino IDE, then confirm that the libraries folder exists in that directory.
Our project's library file link: CrowPanel-Advanced-7inch-ESP32-P4-HMI-AI-Display-1024x600-IPS-Touch-Screen/example/V1.2/Arduino_Code/libraries at master · Elecrow-RD/CrowPanel-Advanced-7inch-ESP32-P4-HMI-AI-Display-1024x600-IPS-Touch-Screen
After determining the location where the library files are stored, copy all the library files contained in the downloaded "libraries" folder to the "C:\Users\Username\Documents\Arduino\libraries" folder on your local computer.
How to add the library files: https://www.elecrow.com/wiki/Arduino_IDE_Library_Import_Guide.html
Note: The course dependency libraries must be placed in the libraries directory under the Arduino Sketchbook folder. After copying is complete, restart the Arduino IDE to prevent it from continuing to use the old library index.
Note: If there is no "libraries" folder in your path, please create one yourself.
3.8 Verify Compilation Before Uploading¶
- Click the Verify (checkmark) button in the upper left.
- Wait for the output area to show that compilation is complete; if errors appear, resolve them first and do not upload directly.
- Click the Upload (right arrow) button.
- Wait for the write progress to reach 100% and see the upload-complete or auto-reset message.
If it stays at Connecting... for a long time, first confirm the UART0 connection, data cable, and COM port; if it still cannot connect, hold the board's BOOT button, then release it once writing begins.
3.9 Open the Serial Monitor to Verify the Result¶
Click the Serial Monitor in the upper right and set the baud rate to 115200. The baud rate must match Serial.begin(115200).
Under normal conditions, the monitor will continuously display:
The interval between adjacent lines is approximately 1 second.
4. Core Code Explanation¶
4.1 setup(): Runs Only Once¶
After the board is powered on or reset, setup() runs only once. Serial.begin(115200) starts the UART0 serial port and sets the communication rate to 115200 bit/s.
4.2 loop(): Runs Repeatedly¶
The Arduino framework calls loop() repeatedly. Serial.print() outputs text, and \r\n handles the line break; delay(1000) pauses for 1000 ms, so it outputs approximately one line per second.
5. Acceptance Criteria¶
- The project compiles without errors during verification.
- The program can be uploaded via UART0 and auto-resets.
- After the Serial Monitor is set to a baud rate of 115200, it continuously displays
Hello World!. - The time interval between adjacent output lines is approximately 1 second.
6. Common Troubleshooting¶
- No port available: Replace the USB-C cable with one confirmed to support data transfer, and check whether it is connected to UART0.
- Upload stuck at
Connecting...: Reselect the actual COM port; if necessary, hold BOOT and release it once writing begins. - ESP32P4 not found during compilation: Go back to the Board Manager and confirm that
esp32 by Espressif Systemsof the version required by the course has been installed. - Garbled output on the serial monitor: Change the Serial Monitor to a baud rate of 115200, then press RESET once.
- Only startup logs, no
Hello World!: Confirm that the.inoopened and uploaded is the one for this lesson, then re-verify and re-upload. - Incorrect output speed: Check whether
delay(1000)has been modified; 1000 ms equals 1 second.















