Hello all!
I am trying to get an sd-mp3 card (midfly tdb380) to play specific sounds via two xbees
I have two boards each with picaxe 40x2's and xbee modules
Trans code:
receive code:
The xbee modules have been programed at 4800 baud
I also have an axe210 board with xbee inserted, that during testing is connected to the pc with an axe027 download cable to try and monitor what's going on.
I also have a sparfun xbee comport/programing board with xbee inserted programed at 4800 for monitoring what's going on.
I program board #1 with the transmit code
I program board #2 with the receive code
when I push button #1 on the transmit board:
1. all 4 xbees flash the send/receive led
2. the receive board is evidently receiving the data thru the 40x2 as the busy light on the sd-mp3 module comes on
3. the terminal on the programing editor shows the data coming thru the xbee mounted on the axe210 ( 1,2 or 3 according to which button is pushed)
4. the terminal on the pc (the one in the xctu program) shows the data being received (1,2 or 3 according which button is pushed)
I am thinking either the correct data is not being loaded into b34 or something in my use of # or $ is wrong.
I have read over the long posting on the tendra sd-mp3 module but somewhere I have gotten something wrong,,
can someone please look over my code and tell me where I messed up?
I spent the whole day yesterday trying different things, sometimes it will play a sound,, but it is never the correct one.
the sd card has been formatted and I used drive sort to check and order the files, even though there are currently only three I am working with.
Thanks in advance
Randy
I am trying to get an sd-mp3 card (midfly tdb380) to play specific sounds via two xbees
I have two boards each with picaxe 40x2's and xbee modules
Trans code:
Code:
'picaxe pinout
'B.7 = xbee transmit pin (xbee pin2)
'B.6 = xbee rec pin (xbee pin3)
'B.5 = xbee sleep pin (xbee pin9)
'B.4 = sd-mp3 busy pin
'B.3 = sd-mp3 rec pin
'B.2 = sd-mp3 trans pin
'B.1 = out to AXE133Y
'A.0 = switch 1 (norm high)
'A.1 = switch 2 (norm high)
'A.2 = switch 3 (norm high)
pause 2000 'TIME FOR SYSTEM TO BOOT
CHECKBUTTONS:
if pina.0 = 0 then 'BUTTON #1 PUSH
pause 1000 'DEBOUNCE FOR BUTTON
serout b.7, T4800,(#001,cr) 'SENDS DATA THRU PIN B.7 TO XBEE
SEROUT B.1,N2400,(254,128,"$001") 'SENDS TRANSMITTED DATA TO LCD FOR VERIFICATION THAT PROGRAM IS CONTINUEING
high D.2 'TURNS ON LED TO VERIFY THAT BUTTON PUSH IS REGISTERED
pause 2000 'GIVES TIME TO LOOK AT LED TO VERIFY THAT BUTTON PUSH IS REGISTERED AND PROGRAM IS RUNNING
low D.2 'TURNS OFF LED INDICATOR
ELSEif pina.1 = 0 then 'BUTTON #2 PUSH
pause 1000 'DEBOUNCDE FOR BUTTON
serout b.7, T4800,(#002,cr) 'SENDS DATA THRU PIN B.7 TO XBEE
serout b.1,N2400,(254,128,"$002") 'SENDS TRANSMITTED DATA TO LCD FOR VERIFICATION THAT PROGRAM IS CONTINUEING
high D.2 'TURNS ON LED TO VERIFY THAT BUTTON PUSH IS REGISTERED
pause 2000 'GIVES TIME TO LOOK AT LED TO VERIFY THAT BUTTON PUSH IS REGISTERED AND PROGRAM IS RUNNING
low D.2 'TURNS OFF LED INDICATOR
ELSEif pina.2 = 0 then 'BUTTON #3 PUSH
pause 1000 'DEBOUNCDE FOR BUTTON
serout b.7, T4800,(#003,cr) 'SENDS DATA THRU PIN B.7 TO XBEE
serout b.1,N4800,(254,128,"$003") 'SENDS TRANSMITTED DATA TO LCD FOR VERIFICATION THAT PROGRAM IS CONTINUEING
high D.2 'TURNS ON LED TO VERIFY THAT BUTTON PUSH IS REGISTERED
pause 2000 'GIVES TIME TO LOOK AT LED TO VERIFY THAT BUTTON PUSH IS REGISTERED AND PROGRAM IS RUNNING
low D.2 'TURNS OFF LED INDICATOR
end if
goto CHECKBUTTONS
receive code:
Code:
'the data is recieved thru the xbee connected to pin B.6 of the 40x2
'I am trying,, and I guess its working to put the data received thru pin B.6 (serin B.6) into the veriable b34
'then I an trying to have b34 (the data received) sent to the sd-mp3 module thru pin B.3
'the lcd thru the 40x2 pin b.1 is only for reference that the correct data is being sent out and if nothing shows on the
'lcd screen it indicates the program is stalling somewhere on or before the "serout B.1,N2400,(254,128,#b34) code line
'picaxe pinout
'B.7 = xbee transmit pin (xbee pin2)
'B.6 = xbee rec pin (xbee pin3)
'B.5 = xbee sleep pin (xbee pin9)
'B.4 = sd-mp3 busy pin
'B.3 = sd-mp3 rec pin
'B.2 = sd-mp3 trans pin
'B.1 = out to AXE133Y
'A.0 = switch 1 (norm high)
'A.1 = switch 2 (norm high)
'A.2 = switch 3 (norm high)
'receive code
high B.6 'SETS B.6 (RECEIVE PIN FROM XBEE) HIGH SO THAT INCOMEING DATA IS READY TO BE RECEIVED
high B.3 'SETS B.3 (OUTPUT PIN TO SD-MP3 MODULE) HIGH SO THAT PICAXE IS READY TO SEND DATA TO MP3 MODULE
serout B.3,T4800,($EF) 'STOPS SD-MP3 MODULE
playsong:
serout b.1,n2400,(254,1) 'CLEARS LCD MONITOR
serin B.6,N4800,b34 'RECEIVES DATA FROM XBEE AND PUTS IT IN b34
serout B.1,n2400,(254,128,#b34) 'SENDS RECEIVED DATA FROM XBEE TO LCD TO VERIFY DATA IS BEING RECEIVED
serout B.3,T4800,(b34) 'SEBDS b34 (RECEIVED DATA) TO SD-MP3 MODULE
goto playsong
The xbee modules have been programed at 4800 baud
I also have an axe210 board with xbee inserted, that during testing is connected to the pc with an axe027 download cable to try and monitor what's going on.
I also have a sparfun xbee comport/programing board with xbee inserted programed at 4800 for monitoring what's going on.
I program board #1 with the transmit code
I program board #2 with the receive code
when I push button #1 on the transmit board:
1. all 4 xbees flash the send/receive led
2. the receive board is evidently receiving the data thru the 40x2 as the busy light on the sd-mp3 module comes on
3. the terminal on the programing editor shows the data coming thru the xbee mounted on the axe210 ( 1,2 or 3 according to which button is pushed)
4. the terminal on the pc (the one in the xctu program) shows the data being received (1,2 or 3 according which button is pushed)
I am thinking either the correct data is not being loaded into b34 or something in my use of # or $ is wrong.
I have read over the long posting on the tendra sd-mp3 module but somewhere I have gotten something wrong,,
can someone please look over my code and tell me where I messed up?
I spent the whole day yesterday trying different things, sometimes it will play a sound,, but it is never the correct one.
the sd card has been formatted and I used drive sort to check and order the files, even though there are currently only three I am working with.
Thanks in advance
Randy
Last edited: