Hi all,
I’ve only been into electronics for about 6 months, so I have a lot to learn. I was hoping someone could help me with a simple problem, I’m looking to find a way to activate a single mp3 file (track 001) when i press a play button on my code in nextion display. Looking to have a sound effect when I run my program. I have all the commands for the DF MP 3 player, but am not sure how to get them to work in my nextion display (just using MCU on display, no Arduino).
Thanks
Welcome to the Particle community
This forum is actually targeted at Particle devices and you should really consider getting some of their awesome devices and try them out - and this community is awesome
However, you are in luck
I have done exactly what you are asking for before
See here
Could not get your .zip file to download, if I could just get an example of the code I need to place in the touch event so it will play track 1 (for sound effect) and then run the code, I think I will be able to expand on that. Im just using a nextion display and df mp3 player, no arduino.
I’m at wits end on finding a simple example of playing a audio file within a nextion display. Any help would be greatly appreciated. Thanks
Even a good link,that might guide me on my problem will do.
Strange, the link seems to work for me (even on a device without Dropbox installed).
Try this one.
However, this is the code I’m using in the touch release handlers (it uses two variables for the desired folder and the sound file numbers)
if(nrSong.val==0)
{
btPlay.val=0
}
if(btPlay.val==0)
{
printh 7e ff 06 0e 01 00 00 fe ec ef
}
if(btPlay.val==1)
{
vCheck.val=65535
vCheck.val=vCheck.val-255
vCheck.val=vCheck.val-6
vCheck.val=vCheck.val-15
vCheck.val=vCheck.val-nrSong.val
vCheck.val=vCheck.val-nrFolder.val
vDmy.val=vCheck.val/256
vCheck.val=vCheck.val*256
vCheck.val=vCheck.val+vDmy.val
vDmy.val=vDmy.val*65536
vCheck.val=vCheck.val-vDmy.val
vDmy.val=nrSong.val*256
vDmy.val=vDmy.val+nrFolder.val
vParam.val=vCheck.val*65536
vParam.val=vParam.val+vDmy.val
printh 7e ff 06 0f 01
print vParam.val
printh ef
delay=500
printh 7e ff 06 0d 01 00 00 fe ed ef
}
(it might well be that Nextion Editor would by now support a less round-about way to construct the command, but back then this was the “best” way I could come up with and it works)