Skip to content

4.3_5.0_7.0inch_Lesson01_Timed_Serial_Output

1. Course Introduction

In this lesson, we use the Elecrow CrowPanel Advance 4.⅗.0/7.0 inch ESP32-S3 HMI development board to complete board configuration, compilation, flashing, and serial monitoring in the Arduino IDE. The program does not initialize the LCD or touchscreen; instead, it outputs Hello, World! and an incrementing counter value through the USB debug serial port approximately every 1 second, in order to verify the "computer—USB—development board—program—serial monitor" chain.

2. Learning Objectives

  • Be able to explain the relationship that setup() runs only once while loop() runs continuously in a loop.
  • Be able to install Espressif ESP32 Arduino Core 3.3.8 and select ESP32S3 Dev Module.
  • Be able to configure 16 MB Flash, the Huge APP partition, OPI PSRAM, and the actual device serial port.
  • Be able to compile and flash the program and set the serial monitor to 9600 baud.
  • Be able to determine whether the program is running normally based on text integrity, counter increment, and output period.

3. What You Need

  • Hardware: One CrowPanel Advance 4.⅗.0/7.0 inch ESP32-S3 HMI development board.
  • Cable: A USB data cable that supports data transfer.
  • Software: Arduino IDE and the ESP32 Arduino development environment. Install Arduino IDE .
  • Board package: esp32 by Espressif Systems 3.3.8.
  • Project: Serial_port_printing.ino.

Code and Resource Download

Code download: - Serial_port_printing

4. Software Operation Steps

  1. Open the Arduino IDE and go to File > Preferences. There is no mandatory requirement for the Arduino IDE version; however, version 2.x is recommended so that the interface matches this tutorial.

image-20260728142815197

  1. In Additional boards manager URLs, add the Espressif ESP32 board index address:
https://adafruit.github.io/arduino-board-index/package_adafruit_index.json

image-20260728142915301

  1. Import the Arduino library files: Before running the sample program, first import the Arduino library files required by the project. Go to File → Preferences, check the Sketchbook location, and navigate to the libraries folder under that path.

Link to the two ways of importing third-party libraries in the Arduino IDE: https://www.elecrow.com/wiki/Arduino_IDE_Library_Import_Guide.html

image-20260728145517293

image-20260731160303682

  1. Open Tools > Board > Boards Manager, search for esp32, and confirm that esp32 by Espressif Systems is installed. Version 3.3.8 is recommended; if the release environment standardizes on a different version, follow the release notes.

4.3_5.0_7.0_Arduino-01_05

  1. Open Environment_Setup.ino with the Arduino IDE.

image-20260730192757230

  1. Under Tools > Board > esp32, select ESP32S3 Dev Module. image-20260728150750867

  2. After connecting the development board, select the newly appeared device serial port under Tools > Port. image-20260728150918309

  3. Set Flash Size to 16MB (128Mb). image-20260728151050697

  4. Set Partition Scheme to Huge APP (3MB No OTA/1MB SPIFFS) image-20260728153658244

  5. Set PSRAM to OPI PSRAM. image-20260728151113412

  6. Click Upload to compile and wait for the upload to complete. If it gets stuck at Connecting..., check for port occupation and use the BOOT/RESET download mode as required by the board. image-20260731144855253

  7. Open the Serial Monitor in the upper-right corner, set it to 9600 baud, and observe the continuous output.

    image-20260731144922217

    image-20260731145024096

5. Hardware Operation Steps

  1. Connect the CrowPanel Advance 4.⅗.0/7.0 inch ESP32-S3 HMI development board to your computer using a USB cable that supports data transfer.

IMG_8145

  1. After flashing is complete, press RESET and observe the serial monitor. It is normal that the LCD does not display Hello, World!, because this lesson contains no LCD drawing code. image-20260731145259684

6. Key Code Explanation

7. Key Code Explanation

int counter = 0;

A global variable starts at 0 on reset and retains its value between loops. If you change it to 10, the first log line will start from 10; restore it to 0 after the experiment.

void setup() {
  Serial.begin(9600);
}

setup() runs only once; Serial.begin(9600) sets the debug serial port baud rate. The monitor must also be set to 9600; otherwise, garbled characters will appear.

Serial.print("Hello, World! ");
Serial.print("--- ");
Serial.println(counter);

The first two print() calls do not add a newline; println() outputs the number and ends the current line, so each loop iteration forms one complete log line. Changing println() to print() would cause multiple iterations of output to be concatenated onto a single line.

counter++;
delay(1000);

The program outputs the current value first, then increments it by 1 and waits 1000 ms. Changing it to 500 makes the output approximately twice as fast; restore the value to 1000.

8. Experimental Observations

After reset, the serial monitor should display content similar to the following:

Hello, World! --- 0
Hello, World! --- 1
Hello, World! --- 2

Acceptance criteria: the text shows no garbled characters; the number increases by 1 per line; the interval between adjacent outputs is about 1 second; it runs continuously without interruption; and it restarts from 0 after pressing RESET. Whether the LCD displays the lesson text is not part of this lesson's acceptance criteria.

image-20260731145319638

9. Code Download

Code path: Serial_port_printing.