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 #153 background imageLoading...
Page #153 background image
SunFounder ESP32 Starter Kit
(continued from previous page)
else if (value == "green") {
setColor(0, 255, 0); // green
Serial.println("green");
}
else if (value == "blue") {
setColor(0, 0, 255); // blue
Serial.println("blue");
}
else if (value == "yellow") {
setColor(255, 150, 0); // yellow
Serial.println("yellow");
}
else if (value == "purple") {
setColor(80, 0, 80); // purple
Serial.println("purple");
}
}
};
Finally, a function is added to set the RGB LED color.
void setColor(int red, int green, int blue) {
// For common-anode RGB LEDs, use 255 minus the color value
ledcWrite(redChannel, red);
ledcWrite(greenChannel, green);
ledcWrite(blueChannel, blue);
}
In summary, this script enables a remote control interaction model, where the ESP32 operates as a Bluetooth Low
Energy (BLE) server.
The connected BLE client (like a smartphone) can send string commands to change the color of an RGB LED. The
ESP32 also gives feedback to the client by sending back the string received, allowing the client to know what operation
was performed.
1.40 7.3 Bluetooth Audio Player
The aim of the project is to provide a simple solution for playing audio from a Bluetooth-enabled device using the
built-in DAC of the ESP32.
The project involves the use of the ESP32-A2DP library to receive audio data from a Bluetooth-enabled device. The
received audio data is then transmitted to the internal DAC of the ESP32 using the I2S interface. The I2S interface
is configured to operate in master mode, transmit mode, and DAC built-in mode. The audio data is then played back
through the speaker connected to the DAC.
When using the internal DAC of the ESP32, it is important to note that the output voltage level is limited to 1.1V.
Therefore, it is recommended to use an external amplifier to boost the output voltage level to the desired level. It is also
important to ensure that the audio data is in the correct format and sample rate to prevent distortion or noise during
playback.
Required Components
In this project, we need the following components.
1.40. 7.3 Bluetooth Audio Player 147

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