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

Problem using ESP on UART1 #61

Open
Gorkde opened this issue May 8, 2024 · 1 comment
Open

Problem using ESP on UART1 #61

Gorkde opened this issue May 8, 2024 · 1 comment

Comments

@Gorkde
Copy link

Gorkde commented May 8, 2024

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 status

exit status 1

Compilation error: exit status 1`

Here is my minimalized code:

`#include <DYPlayerESP32.h>

// 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?

@Gorkde
Copy link
Author

Gorkde commented May 8, 2024

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 <HardwareSerial.h>
#include <DYPlayerArduino.h>

//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
}
`

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