Hi all, I am having trouble figuring this out. I want an mp3 to loop until a PIR is detected upon which it switches to another mp3. I tried this but it would only switch once mp3 1 was finished.
I tried this but the mp3 would only play for 5 seconds and loop back. The track is 28 seconds long. I would think "pause 28000" would stop program flow for 28 seconds.
I read the if/elseif section of manual 2. I am sure there is a simple way to do this, I'm just not seeing it.
Code:
Main0:
serout TENDA, BAUD, ($E8)
Do
serout TENDA, Baud, ($F2,01) `play Track 1, Folder 2
pause 1000
readadc PIR,debounce
if debounce>50 then Open_Chant 'if triggered go to opening chant
gosub Test_Busy_Line 'check busy line before doing anything else
loop while debounce < 50 'if not triggered sit in this loop
Test_Busy_Line:
Do
if Wait_If_Busy = 1 then exit
Loop
return
Code:
Main0:
serout TENDA, BAUD, ($E8) 'set Tenda volume
Do
serout TENDA, Baud, ($F2,01) `play Track 1, Folder 2
pause 5000
readadc PIR,debounce
if debounce>50 then Open_Chant 'if triggered go to opening chant
loop while debounce < 50 'if not triggered sit in this loop