EasyManua.ls Logo

DFRobot FIREBEETLE BOARD-ESP32 - Project 2: PWM Breathing Light

DFRobot FIREBEETLE BOARD-ESP32
49 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Welcome to DFRobot: www.DFRobot.com.cn 22 / 49
Project2: PWM (Breathing light)
PWM, let FireBeetle Board-ESP32 drive LED light by PWM, realizing light gradient overlay which is
similar to the action of breathing. Please refer to knowledge expand for the explanation of PWM.
Components in need
1 x FireBeetle Board-ESP32
Hardware linking method
No need for other sensor, L LED light in the FireBeetle Board-ESP32 is available. Please connect
FireBeetle Board-ESP32 directly to your computer by USB data wire.
Enter code
Open Arduino IDE. You would better enter the code manually than open Course->Item-2 to be
familiar with it.
Sample code:
//use first channel of 16 channels (started from zero)
#define LEDC_CHANNEL_0 0
// use 13 bit precission for LEDC timer
#define LEDC_TIMER_13_BIT 13
// use 5000 Hz as a LEDC base frequency
#define LEDC_BASE_FREQ 5000
//Set LED light