B4R Question how to integrate wt2000 to DFPlayer_mini_mp3 ?

Hans- Joachim Krahe

Active Member
Licensed User
Longtime User
... there is a new error in a compilat, that worked fine before. Trying to compile it, DFPlayer_Mini_Mp3.h is not found, although it is placed in the library as before. Does anyone know a reason?


E:\Entwicklung\B4R\Goedecke\Objects\bin\sketch\b4r_main.cpp:61:32: fatal error: DFPlayer_Mini_Mp3.h: No such file or directory
 
Upvote 0

thetahsk

Active Member
Licensed User
Longtime User
... there is a new error in a compilat, that worked fine before. Trying to compile it, DFPlayer_Mini_Mp3.h is not found, although it is placed in the library as before. Does anyone know a reason?


E:\Entwicklung\B4R\Goedecke\Objects\bin\sketch\b4r_main.cpp:61:32: fatal error: DFPlayer_Mini_Mp3.h: No such file or directory

..post your code and project file. Did you installed the DFplayer lib's in your Arduino IDE ?
 
Last edited:
Upvote 0

Hans- Joachim Krahe

Active Member
Licensed User
Longtime User
i just copied the libs to additional lib folder. DFPlayer_mini_mp3 is only used as #include. is there a further installation procedure, I forgot? Otherwise, I will pack the project and send it to you...
 
Upvote 0

Hans- Joachim Krahe

Active Member
Licensed User
Longtime User
DFPlayer_Mini_Mp3 Folder ist not being copied into sketch folder - if I copy it manuel, it is DELETED in the beginning of compilation process...


B4X:
#Region Project Attributes
    #AutoFlushLogs: True
    #CheckArrayBounds: True
    #StackBufferSize: 300
#End Region
' https://www.dfrobot.com/wiki/index.php/DFPlayer_Mini_SKU:DFR0299#Information_derections


Sub Process_Globals
   Public Serial1 As Serial
    Private Softserial1, Softserial2 As SoftwareSerial
       Private Astream, NanoStream, mp3Stream As AsyncStreams
  
     Private udp As WiFiUDP
    Private UDPPort As Double = 11000
  
  
  
    'Private pin5 As Pin
    Private d1 As D1Pins
    
    Private wifi As ESP8266WiFi
    Private server As WiFiServerSocket
    Private eeprom As EEPROM
    
    
    
    Private timer1 As Timer
    Private bc As ByteConverter
    Private Volume As UInt
    Private Num As UInt
    Private State As Boolean  'ignore
    Private answer As Byte
    Private total_files, current As Int
    Private play As Boolean = True
    Private PLoop As Boolean = False
    
    
    Private Cmd As Byte  ' ignore
    Private Arg As UInt   ' ignore
    
    Private ssid As String = "myMP3" 'ignore
    Private password As String = "8512851285128512" 'ignore
    Private channel As Int = 4 'ignore

End Sub

Private Sub AppStart

    Serial1.Initialize(115200)
    Log("AppStart")

    mp3Stream.Initialize(Softserial2.Stream, "mp3_NewData", "mp3_Error")
'     
    'RunNative("Mp3_set_serial", Null)
    Delay(150)
    Volume = 25
    'RunNative("Mp3_set_volume", Null) 
    Delay(150)
    'PLoop = False
    'RunNative("Mp3_single_loop", Null)
    
    answer = 1
    'RunNative("Mp3_get_tf_sum",Null)
    
    current = 0
    Log("ok")
    
'    Cmd = 0x06
'    Arg = 14
    'RunNative("Mp3_send_cmd", Null)
    'RunNative("setSoftAP", Null)
    Softserial2.Listening = False
    Softserial1.Listening = True
End Sub


Sub mp3_NewData (Buffer() As Byte)
    Log(bc.HexFromBytes(Buffer))
    
    Log("return= " , answer)
    Select answer
        Case 0
            
        Case 1
            total_files = Buffer(5) + Buffer(6)
            Log( "totalFiles=",total_files)
        Case 2
            Log("current = " , Buffer(5) + Buffer(6))
            current = Buffer(5) + Buffer(6)
    End Select
    answer = 0
End Sub
Sub mp3_Error
    Log("p2 error")
End Sub


'Sub Udp_PacketArrived (Data() As Byte, Ip() As Byte, myPort As UInt)
'       
'    Log("udpArrived ",Data)
'    Private st As String = bc.StringFromBytes(Data)
'    'Private st2() As Byte = bc.SubString2(st,0,3)
'   
'    If bc.StartsWith(Data,"<") Then  ' sensitivity, loudness etz
'        NanoStream.Write(Data)
'        Log(">Nano:",st)
'    End If   
'       
'    If bc.StartsWith(Data,"Play_") Then
'        NanoStream.Write(bc.StringToBytes("news from nano"))
'        Log("PlayOrder:",st)
'        Num = bc.StringFromBytes(bc.SubString2(Data,5, 8)) ' "Play_003"
'        State = False
'        'RunNative("Mp3_single_loop", Null)
'        'RunNative("Mp3_play_1", Null)
'        play = True
'        PLoop = False
'        current = Num
'       
'    End If
'   
'
'   
'
'    Select st
'       
'       
'       
'       
'        Case  "Volinc"
'            Volume = Volume + 5
'            'RunNative("Mp3_set_volume", Null)
'             
'        Case  "Voldec"
'            Volume = Max(Volume - 5, 0)
'            'RunNative("Mp3_set_volume", Null)
'       
'        Case  "Loop"
'            If PLoop Then
'                State = False
'                'RunNative("Mp3_single_loop", Null)
'                PLoop = False
'            Else
'                State = True
'                'RunNative("Mp3_single_loop", Null)
'                PLoop = True
'            End If
'           
'        Case  "Playpause"
'            If play Then
'                'RunNative("Mp3_pause", Null)
'                play = False
'            Else
'                'RunNative("Mp3_play", Null)
'                play = True
'            End If
'           
'        Case "Stop"
'            'RunNative("Mp3_stop", Null)
'            current = 0
'            play = False
'            PLoop = False
'           
'        Case Else  ' song number
'
'    End Select
'    'Log("current= ",current)
'
'End Sub
'
''

#If C
#include <DFPlayer_Mini_Mp3.h>

void setSoftAP(B4R::Object* o) {
   WiFi.softAP(b4r_main::_ssid->data, b4r_main::_password->data, b4r_main::_channel);
}

void Mp3_set_serial(B4R::Object* o) {
   SoftwareSerial* soft = (SoftwareSerial*)b4r_main::_softserial2->getStream()->wrappedStream;
   mp3_set_serial(*soft);
}

//void Mp3_single_loop(B4R::Object* o){
//mp3_single_loop(b4r_main::_ploop);
//}

//void Mp3_send_cmd(B4R::Object* o) {
// mp3_send_cmd(b4r_main::_cmd, b4r_main::_arg);
//}

//void Mp3_send_cmd(B4R::Object* o) {
// mp3_send_cmd(b4r_main::_cmd);
//}

void Mp3_play_1(B4R::Object* o) {
 //mp3_play_physical(b4r_main::_num);
 mp3_play(b4r_main::_num);
}

void Mp3_play_2(B4R::Object* o) {
 mp3_single_play(b4r_main::_num);
}

void Mp3_play(B4R::Object* o) {
 mp3_single_play(b4r_main::_num);
}

void Mp3_set_volume(B4R::Object* o) {
 mp3_set_volume(b4r_main::_volume);
}

void Mp3_next(B4R::Object* o) {
 mp3_next();
}

void Mp3_prev(B4R::Object* o) {
 mp3_prev();
}

void Mp3_sleep(B4R::Object* o) {
 mp3_sleep();
}

void Mp3_reset(B4R::Object* o) {
 mp3_reset();
}

void Mp3_pause(B4R::Object* o) {
 mp3_pause();
}

void Mp3_random_play(B4R::Object* o) {
 mp3_random_play();
}

void Mp3_stop(B4R::Object* o) {
 mp3_stop();
}

void Mp3_single_loop(B4R::Object* o) {
 mp3_single_loop(b4r_main::_state);
}

void Mp3_get_tf_sum(B4R::Object* o) {
 mp3_get_tf_sum();
}

void Mp3_get_tf_current(B4R::Object* o) {
 mp3_get_tf_current();
}

#End If
 

Attachments

  • libTest.zip
    71.3 KB · Views: 265
Upvote 0

thetahsk

Active Member
Licensed User
Longtime User
i just copied the libs to additional lib folder. DFPlayer_mini_mp3 is only used as #include. is there a further installation procedure, I forgot? Otherwise, I will pack the project and send it to you...

Open your Arduino IDE and press Strg+ Umschalt+I and search for "DFPlayerMini" in Bibliotheksverwalter and install DFRobotDFPlayerMini.
Close IDE and open B4R and try to compile.
 
Upvote 0

Hans- Joachim Krahe

Active Member
Licensed User
Longtime User
thank you, I tried, but does not match.

Did the *include* function beeing changed in newer B4R versions, or is it just a bug at my side?
 
Upvote 0
Top