DFRobot / DFRobot_DF1201S

Here comes the DFPlayer Pro-a mini simple but powerful MP3 Player! This MP3 player module supports four controlling modes: Arduino, AT command, on-board buttons, and ADKEY. You can directly press the on-board button to play or switch music without using a controller. By using a USB cable, you can easily copy your favorite songs into this module to play them any where you want, or use it as a sound card for your PC or Raspberry Pi after connecting them together.
MIT License
7 stars 5 forks source link

Error: ambiguous overload for 'operator=' #11

Open ronibandini opened 1 year ago

ronibandini commented 1 year ago

If you get this error

C:\Users\R\Documents\Arduino\libraries\DFRobot_DF1201S-master\src\DFRobot_DF1201S.cpp:65:21: error: ambiguous overload for 'operator=' (operand types are 'arduino::String' and 'char') playMode = str[10]; ^ Open DFRobot_DF1201S.cpp

And replace playMode = str[10]; by playMode = (const char*)str[10];

If you want to use DfPlayer Pro with UNO R4 Minima, replace in the Play.ino example

if defined(ARDUINO_AVR_UNO) || defined(ESP8266)

include "SoftwareSerial.h"

SoftwareSerial DF1201SSerial(2, 3); //RX TX

else

define DF1201SSerial Serial1

endif

by

SoftwareSerial DF1201SSerial(2, 3);

qsjhyy commented 1 year ago

Thank you very much for the tip

zongone commented 11 months ago

Same problem occurs with Raspberry PI Pico under Arduino. The correct replacement should be: playMode = str[10]; to: playMode += str[10];

playMode = (const char*)str[10]; -> works incorrectly in my case

sbarabe commented 8 months ago

Same here with Arduino Every on PlatformIO.

Changed to: playMode = String(str[10]); and it works

playMode = (const char*)str[10]; -> also works for me