EasyManuals Logo

Freenove ESP32-S3 User Manual

Default Icon
142 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #37 background imageLoading...
Page #37 background image
Any concerns? support@freenove.com
35
Chapter 1 LED
www.freenove.com
8
13
void loop() {
}
In the circuit, ESP32-S3 WROOM's GPIO2 is connected to the LED, so the LED pin is defined as 2.
1
#define LED_BUILTIN 2
This means that after this line of code, all LED_BUILTIN will be treated as 2.
In the setup () function, first, we set the LED_BUILTIN as output mode, which can make the port output high
level or low level.
4
5
// initialize digital pin LED_BUILTIN as an output.
pinMode(LED_BUILTIN, OUTPUT);
Then, in the loop () function, set the LED_BUILTIN to output high level to make LED light up.
10
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
Wait for 1000ms, that is 1s. Delay () function is used to make control board wait for a moment before executing
the next statement. The parameter indicates the number of milliseconds to wait for.
11
delay(1000); // wait for a second
Then set the LED_BUILTIN to output low level, and LED light off. One second later, the execution of loop ()
function will be completed.
12
13
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
The loop() function is constantly being executed, so LED will keep blinking.
Reference
void pinMode(int pin, int mode);
Configures the specified pin to behave either as an input or an output.
Parameters
pin: the pin number to set the mode of.
mode: INPUT, OUTPUT, INPUT_PULLDOWM, or INPUT_PULLUP.
void digitalWrite (int pin, int value);
Writes the value HIGH or LOW (1 or 0) to the given pin which must have been previously set as an output.
For more related functions, please refer to https://www.arduino.cc/reference/en/
Reset
Reset operation will lead the code to be executed from the beginning. Switching on the power, finishing
uploading the code and pressing the reset button will trigger reset operation.

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Freenove ESP32-S3 and is the answer not in the manual?

Freenove ESP32-S3 Specifications

General IconGeneral
BrandFreenove
ModelESP32-S3
CategoryControl Unit
LanguageEnglish