Open Gorkde opened 6 months ago
Solved that by using the arduino lib.
So maybe I thought wrongly before and the ESP code is only for the ESP IDE? Then you should state that clearly so evgerybody understands!
Here is the working code:
`#include
//Serielle Schnittstelle2 initialisieren HardwareSerial SerialPort1(1); // use UART1
// Musik initialisieren DY::Player Music(&SerialPort1);
void setup() {
// Serielle Schnittstellen initialisieren Serial.begin(115200); // Serielle Ausgabe an SerialPort1.begin(9600, SERIAL_8N1, 33, 25); // Serielle Schnittstelle 1 für Audio an
// Sound initialisieren Music.begin(); Music.setCycleMode(DY::PlayMode::OneOff); // File einmal abspielen, dann stop }
void loop() { Music.play(); // Musik abspielen Music.next(); // Zum nächsten Titel wechseln } `
For some reason I cant use the lib on UART1 of an ESP32 module (Doit Devkit V1) using the Arduino IDE and get an error whose reason I dont understand:
This is the error:
c:/users/gorkde/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\Gorkde\AppData\Local\Temp\arduino\sketches\7E5FE3F65971D37C0376085A1A8B3022\sketch\TEST.ino.cpp.o:(.literal.startup._GLOBAL__sub_I_player+0x4): undefined reference to
DY::Player::Player(int, unsigned char, unsigned char)' c:/users/gorkde/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\Gorkde\AppData\Local\Temp\arduino\sketches\7E5FE3F65971D37C0376085A1A8B3022\sketch\TEST.ino.cpp.o: in function_GLOBAL__sub_I_player': C:\Users\Gorkde\Documents\Arduino\Sketches\TEST/TEST.ino:4: undefined reference to
DY::Player::Player(int, unsigned char, unsigned char)' collect2.exe: error: ld returned 1 exit statusexit status 1
Compilation error: exit status 1`
Here is my minimalized code:
`#include
// Musik initialisieren DY::Player player(1, 33, 25); // Initialise the player on UART1, pins TX: 33, RX: 25.
void setup() { }
void loop() { }`
And my last question: How can I use an already initialised hardwareserial.h port as source for the player?