EasyManuals Logo

SunFounder ESP32 User Manual

Default Icon
771 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 #30 background imageLoading...
Page #30 background image
SunFounder ESP32 Starter Kit
Code
Note:
You can open the file 2.2_fading_led.ino under the path of esp32-starter-kit-main\c\codes\2.
2_fading_led.
After selecting the board (ESP32 Dev Module) and the appropriate port, click the Upload button.
Always displaying “Unknown COMxx”?
After the code is uploaded successfully, you can see the LED breathing.
How it works
1. Define constants and variables
const int ledPin = 26; // The GPIO pin for the LED
int brightness = 0;
int fadeAmount = 5;
ledPin: The GPIO pin number where the LED is connected (in this case, GPIO 26).
brightness: The current brightness level of the LED (initially set to 0).
fadeAmount: The amount by which the LED’s brightness will change in each step (set to 5).
2. Initializes the PWM channel and configures the LED pin.
24 Chapter 1. For Arduino User

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the SunFounder ESP32 and is the answer not in the manual?

SunFounder ESP32 Specifications

General IconGeneral
BrandSunFounder
ModelESP32
CategoryController
LanguageEnglish