File tree Expand file tree Collapse file tree 2 files changed +11
-6
lines changed
Expand file tree Collapse file tree 2 files changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ uint16_t DFRobotDFPlayerMini::calculateCheckSum(uint8_t *buffer){
3333void DFRobotDFPlayerMini::sendStack (){
3434 if (_sending[Stack_ACK]) {
3535 while (_isSending) {
36+ delay (0 );
3637 available ();
3738 }
3839 }
@@ -81,7 +82,9 @@ void DFRobotDFPlayerMini::disableACK(){
8182
8283bool DFRobotDFPlayerMini::waitAvailable (){
8384 _isSending = true ;
84- while (!available ());
85+ while (!available ()){
86+ delay (0 );
87+ }
8588 return _handleType != TimeOut;
8689}
8790
@@ -195,6 +198,7 @@ bool DFRobotDFPlayerMini::validateStack(){
195198
196199bool DFRobotDFPlayerMini::available (){
197200 while (_serial->available ()) {
201+ delay (0 );
198202 if (_receivedIndex == 0 ) {
199203 _received[Stack_Header] = _serial->read ();
200204#ifdef _DEBUG
@@ -394,7 +398,6 @@ int DFRobotDFPlayerMini::readVolume(){
394398
395399uint8_t DFRobotDFPlayerMini::readEQ (){
396400 sendStack (0x44 );
397- while (!available ());
398401 if (waitAvailable ()) {
399402 return read ();
400403 }
Original file line number Diff line number Diff line change 11/* **************************************************
22DFPlayer - A Mini MP3 Player For Arduino
3- <https://www.dfrobot.com/index.php?route=product/product&product_id=1121>
3+ <https://www.dfrobot.com/index.php?route=product/product&search=mp3&description=true& product_id=1121>
44
55 ***************************************************
66 This example shows the basic function of library for DFPlayer.
77
8- Created 2016-12-07
8+ Created 2014-8-28
99 By [Angelo qiao]([email protected] ) 1010
1111 GNU Lesser General Public License.
@@ -15,7 +15,7 @@ DFPlayer - A Mini MP3 Player For Arduino
1515
1616/* **********Notice and Trouble shooting***************
1717 1.Connection and Diagram can be found here
18- <https://www.dfrobot.com/wiki/index.php/DFPlayer_Mini_SKU:DFR0299#Connection_Diagram >
18+ <>
1919 2.This code is tested on Arduino Uno, Leonardo, Mega boards.
2020 ****************************************************/
2121
@@ -40,7 +40,9 @@ void setup()
4040 Serial.println (F (" Unable to begin:" ));
4141 Serial.println (F (" 1.Please recheck the connection!" ));
4242 Serial.println (F (" 2.Please insert the SD card!" ));
43- while (true );
43+ while (true ){
44+ delay (0 ); // Code to compatible with ESP8266 watch dog.
45+ }
4446 }
4547 Serial.println (F (" DFPlayer Mini online." ));
4648
You can’t perform that action at this time.
0 commit comments