Hey,
In a couple of apps using the Vmusic2 I had to know when the module had finished playing a sound file. I couldn’t figure out how to do it through the firmware so I did it this way:
- solder a wire from the indictor LED (the leg nearest the usb connector).
- connect this wire directly to In3 (leg 14), on a picaxe 28x1 in this case.
- the firmware flashes the LED on/off while playing music and then keeps it on when finished playing.
The LED output wire pulses High Low when playing a file then goes Low (and stays Low) when finished playing it.
Use a pulsin command, within a loop, to figure out when the file was finished playing. If w3 contains any value other than 0 then the file is playing. The program will be stuck in the loop until w3 contains 0 (a time out). This means the file is done. Pretty cheesy hack, but it works:
‘your program has started playing a track by the time it gets here.
'**** Look for pulses from the LED wire… which means File is Playing
check_playing:
pulsin 3,0,w3 ' Check to see if pin3 has a pulse on the input.
sertxd (#w1, lf) ‘ for testing, you can remove this later
if w3 <> 0 then check_playing 'Loop until the LED stops flashing
sertxd ("File done") ‘File has stopped playing here
In a couple of apps using the Vmusic2 I had to know when the module had finished playing a sound file. I couldn’t figure out how to do it through the firmware so I did it this way:
- solder a wire from the indictor LED (the leg nearest the usb connector).
- connect this wire directly to In3 (leg 14), on a picaxe 28x1 in this case.
- the firmware flashes the LED on/off while playing music and then keeps it on when finished playing.
The LED output wire pulses High Low when playing a file then goes Low (and stays Low) when finished playing it.
Use a pulsin command, within a loop, to figure out when the file was finished playing. If w3 contains any value other than 0 then the file is playing. The program will be stuck in the loop until w3 contains 0 (a time out). This means the file is done. Pretty cheesy hack, but it works:
‘your program has started playing a track by the time it gets here.
'**** Look for pulses from the LED wire… which means File is Playing
check_playing:
pulsin 3,0,w3 ' Check to see if pin3 has a pulse on the input.
sertxd (#w1, lf) ‘ for testing, you can remove this later
if w3 <> 0 then check_playing 'Loop until the LED stops flashing
sertxd ("File done") ‘File has stopped playing here