jensmith25
Senior Member
Hi all,
I've got the SPE035 MP3 module with the associated AXE171 14m2 board working nicely but I want to do what I thought was simple and flash the two onboard LEDs once every 2 seconds.
The problem is I can either
1) flash the LEDs
2) play the mp3
but not both together.
I've tried loads of different options and I know it's looping the LEDs that is stopping the programme so how do I integrate it so both work? I've tried toggle and that doesn't even flash the LEDs.
The track runs continuously.
This code has the LEDs flashing correctly but no mp3 playing. I tried integrating it with the onboard switch to see if that would help but pressing the switch doesn't stop the LEDs flashing or start the MP3 player.
I've got the SPE035 MP3 module with the associated AXE171 14m2 board working nicely but I want to do what I thought was simple and flash the two onboard LEDs once every 2 seconds.
The problem is I can either
1) flash the LEDs
2) play the mp3
but not both together.
I've tried loads of different options and I know it's looping the LEDs that is stopping the programme so how do I integrate it so both work? I've tried toggle and that doesn't even flash the LEDs.
The track runs continuously.
This code has the LEDs flashing correctly but no mp3 playing. I tried integrating it with the onboard switch to see if that would help but pressing the switch doesn't stop the LEDs flashing or start the MP3 player.
Code:
#Picaxe 14M2
' Play mp3 files on audio pcb Axe171 in continuous loop
' © Small Scale Lights / JS Miniatures 2016-2017
Symbol TX = B.4
Symbol RX = C.3
Symbol BUSY_PIN = pinC.2
Symbol BAUD_FREQ = M8
symbol mdefault = m4
Symbol BAUD = T9600_8
Symbol cmd = b0
Symbol arg = w1 ; b3:b2
Symbol arg.lsb = b2
Symbol arg.msb = b3
Symbol varA = w2
High TX ; set TX pin high for idle high serial
Pause 2000
SerTxd("Starting", CR, LF )
SerTxd("Select microSD Card", CR, LF )
cmd = $09 : arg = $0002 : Gosub Send
Pause 4000
SerTxd("Set volume 16", CR, LF )
cmd = $06 : arg = 16 : Gosub Send
Pause 1000
if pinC.0 = 0 then
do
high B.2, B.5
pause 500
low B.2, B.5
pause 2000
loop
endif
' Play track 1
cmd = $12 : arg = $0001 : Gosub Send
' Repeat forever
cmd = $08 : arg = $0002 : Gosub Send
Sertxd("Done", CR, LF )
Stop
Send:
SetFreq BAUD_FREQ
Pause 10
SerOut TX, BAUD, ( $7E, $FF, $06, cmd, $00, arg.msb, arg.lsb, $EF )
SetFreq MDEFAULT
Return
end