Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The ESP32-audioI2S library is incompatible with the Bluetooth serial port library #954

Open
jinxicheng1218 opened this issue Jan 20, 2025 · 0 comments

Comments

@jinxicheng1218
Copy link

When importing "BluetoothSerial.h" library in a project containing ESP32-AudioI2S, even if there is no instantiation of Bluetooth serial port, it will cause esp32 can not play audio normally, the program is set in the setup function after selecting the sd card file, play in the loop. The phenomenon is that after restarting the esp32, the audio will play normally for less than a second, then start to stall, and finally stop playing. Or don't play the audio in the first place

Here's my code:

#include "Audio.h"
#include <SPI.h>
#include "SD.h"
#include "FS.h"
#include "BluetoothSerial.h"
#include "soc/soc.h"
#include "soc/rtc_cntl_reg.h"

#define SCL 22
#define SDA 21
//TF卡
#define SD_CS 15
#define SPI_MOSI 13
#define SPI_MISO 16
#define SPI_SCK 14
//喇叭
#define I2S_DOUT 25
#define I2S_BCLK 27
#define I2S_LRC 26
//按键
#define BUTTON 17
#define BT_LED 18
//ws2812
#define WS 19
//数据记录
#define GESTURE_NUM 16
#define Kbps 705

Audio audio;

void setup() {
Serial.begin(115200);
WRITE_PERI_REG(RTC_CNTL_BROWN_OUT_REG, 0); //disable detector
pinMode(BUTTON,INPUT_PULLUP);
pinMode(BT_LED,OUTPUT);
pinMode(SD_CS, OUTPUT);

digitalWrite(BT_LED,0);

Serial.begin(115200);

digitalWrite(SD_CS, LOW);
delay(10);
digitalWrite(SD_CS, HIGH);
SPI.begin(SPI_SCK, SPI_MISO, SPI_MOSI);
SPI.setFrequency(1000000);
SD.begin(SD_CS);

audio.setPinout(I2S_BCLK, I2S_LRC, I2S_DOUT);
audio.setVolume(6); //max 21
audio.connecttoFS(SD, "/bgm.wav");
//SerialBT.begin("test_espbt");
}

void loop() {
audio.loop();
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant