keyestudio
Share your creative ideas with us here
By ran | 25 September 2024 | 0 Comments

Hello World !

Overview

For ESP32 beginners, we will start with some simple things. In this project, you only need a ESP32 mainboard, a USB cable and a computer to complete the “Hello World!” project, which is a test of communication between the ESP32 mainboard and the computer as well as a primary project.

Components

image-20230505174059444

Wiring Diagram

In this project, we will use a USB cable to connect the ESP32 to a computer.

Img

Test Code

//*************************************************************************************
/*
 * Filename    : Hello World
 * Description : Enter the letter R,and the serial port displays"Hello World".
 * Auther      :http//www.keyestudio.com
*/
char val;// defines variable "val"
void setup()
{
Serial.begin(9600);// sets baudrate to 9600
}
void loop()
{
  if (Serial.available() > 0) {
    val=Serial.read();// reads symbols assigns to "val"
    if(val=='R')// checks input for the letter "R"
    {  // if so,    
     Serial.println("Hello World!");// shows “Hello World !”.
    }
  }
}
//*************************************************************************************

Before uploading the test code to the ESP32,click “Tools” → “Board”,select “ESP32 Wrover Module”.

Select the correct serial port.

Note: For macOS users, if the upload fails, set the baud rate to 115200 before clicking.

Clickto upload the test code to the ESP32.

Note: If the uploading code fails, you can press and hold the Boot button on the ESP32 after clickingand release the Boot button after the percentage of uploading progress appears., as shown below:

The code is uploaded successfully.

Test Result

After uploading successfully,we will use a USB cable to power on, click,set the baud rate to 9600,enter the letter “R”,click “Send”,then the serial monitor prints “Hello World!”.

Leave a Reply

Your email address will not be published.Required fields are marked. *
Name
E-mail
Content
Verification code