My 3 yr old's vmusic2 player is nearly complete. I have just 3 things left to sort out (battery charging - LOL!), how to detect track end, and how to detect track time elapsed.
Actually, I sorted out the last one myself. I'm using the AXE033 module with the RTC, so I take the 1Hz pulse off pin 7 of the RTC into a picaxe input - presto - an accurate timesource I can manipulate with some maths.
The battery charging - simple delta V, use a picaxe to measure voltage of the batteries, repeat and adjust / switch off as appropriate. Slow'n'steady as she goes!
The last bit is the bit that's haunting me. How to tell when the track has finished playing. The vmusci2 module (allegedly) can send the picaxe a little note when the track stops playing. My problem is how to trap that.
Here's the code I have at the moment:
get_response2: ' check for playing bytes
point = 0
hserptr = 0
pause 100
read_again:
get point,b20,b21,b22
if b20 = 83 and b21 = 116 then play_stopped ' play has stopped
if play_all = 1 and b20 = 80 and b21 = 108 then play_all_next_track ' display next track info
What I was trying to do was see if the vmusic2 was sending an 83,116 or 'St' for 'Stopped'. SImilarly, if it found an 80,108, that's 'Pl' from 'Playing'. If one of these suddenly popped up in a play-all situation, it would mean that we're onto the next track.
Unfortunately the stream of data coming back from the vmusic2 seems to be a real lottery. All kinds of numbers all over the place seem to pop up in b20,b21,b22. Someone suggested a different approach with HSERIN might be able to clean the data up better than the mongreled method above. Might have been you Hippy ;-)
If someone can help me work through HSERIN to solve this last piece of the puzzle I'd be very grateful. Even just pointers in the right direction, I don't expect anyone to write my code for me
thanks!
Actually, I sorted out the last one myself. I'm using the AXE033 module with the RTC, so I take the 1Hz pulse off pin 7 of the RTC into a picaxe input - presto - an accurate timesource I can manipulate with some maths.
The battery charging - simple delta V, use a picaxe to measure voltage of the batteries, repeat and adjust / switch off as appropriate. Slow'n'steady as she goes!
The last bit is the bit that's haunting me. How to tell when the track has finished playing. The vmusci2 module (allegedly) can send the picaxe a little note when the track stops playing. My problem is how to trap that.
Here's the code I have at the moment:
get_response2: ' check for playing bytes
point = 0
hserptr = 0
pause 100
read_again:
get point,b20,b21,b22
if b20 = 83 and b21 = 116 then play_stopped ' play has stopped
if play_all = 1 and b20 = 80 and b21 = 108 then play_all_next_track ' display next track info
What I was trying to do was see if the vmusic2 was sending an 83,116 or 'St' for 'Stopped'. SImilarly, if it found an 80,108, that's 'Pl' from 'Playing'. If one of these suddenly popped up in a play-all situation, it would mean that we're onto the next track.
Unfortunately the stream of data coming back from the vmusic2 seems to be a real lottery. All kinds of numbers all over the place seem to pop up in b20,b21,b22. Someone suggested a different approach with HSERIN might be able to clean the data up better than the mongreled method above. Might have been you Hippy ;-)
If someone can help me work through HSERIN to solve this last piece of the puzzle I'd be very grateful. Even just pointers in the right direction, I don't expect anyone to write my code for me
thanks!