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 #56 background imageLoading...
Page #56 background image
SunFounder ESP32 Starter Kit
Code
Note:
Open the 3.2_custom_tone.ino file under the path of esp32-starter-kit-main\c\codes\3.
2_custom_tone.
After selecting the board (ESP32 Dev Module) and the appropriate port, click the Upload button.
Always displaying “Unknown COMxx”?
After the code is successfully uploaded, you will hear the passive buzzer play a sequence of 7 musical notes.
How it works?
1. Define constants for the buzzer pin and PWM resolution.
const int buzzerPin = 14; //buzzer pin
const int resolution = 8;
2. Define an array containing the frequencies of the 7 musical notes in Hz.
int frequencies[] = {262, 294, 330, 349, 392, 440, 494};
3. Create a function to play a given frequency on the buzzer for a specified duration.
50 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