EasyManuals Logo

Freenove ESP32 User Manual

Default Icon
159 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 #100 background imageLoading...
Page #100 background image
Need support? support@freenove.com
98
Chapter 8 Buzzer
www.freenove.com
19
20
21
22
23
24
25
ledcWrite(BUZZER_CHN, 512);
ledcWriteTone(BUZZER_CHN, freq);
} else {
ledcWrite(BUZZER_CHN, 0);
ledcWriteTone(BUZZER_CHN, 0);
}
}
The melody playback function. Every time this function is called, a thread will be created to control the buzzer
to play the tune with the specified frequency.
40
41
42
43
44
void setMelodyToPlay(int m) {
melody = m;
enableBuzzered = true;
xTaskCreateUniversal(task_Buzzered, "task_Buzzered", 2048, NULL, 1, &taskHandle_Buzzered, 0);
}
Buzzer thread callback function. Each time the thread is executed, the
vTaskDelete(xTaskGetCurrentTaskHandle()) function is automatically called to close its own thread.
void task_Buzzered(void *pvParameters) {
if (enableBuzzered) {
switch (melody) {
……
}
}
vTaskDelete(xTaskGetCurrentTaskHandle());
}

Questions and Answers:

Question and Answer IconNeed help?

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

Freenove ESP32 Specifications

General IconGeneral
BrandFreenove
ModelESP32
CategoryComputer Hardware
LanguageEnglish

Related product manuals