I am trying to use an 08M2 and two Tenda modules on an animatronics project. it is for a pair of witches for a Halloween display. The idea is for them to say verses from various chants, at times together and at times sequentially. The files are balanced in that both voices have the same db output. Here is the code
The project is currently set up on a breadboard. I intend to add a PIR on pin C.2
Parts of the code do seem to be working as I intended. It does call up a file from one module, then the next file from the other and so on. However, a number of things are occuring (or not occuring).
1. The code is skipping over "Happy_Halloween" entirely and going right to "Spellcast".
2. It won't call up files on both modules at the same time, as is indicated in various sections of the code (Happy_Halloween, Macbeth).
3. It will call up the same file a couple of times before forwarding to next file (specifically in "Early_Early [$F2,07])
4. It always calls up "Early_Early" first, and will call it up multiple times
5. One of the Tenda modules is a third of the volume of the other. I have tried switching the SD cards and the 3.5mm jacks and it is the module (I realize I could have a bad module}.
Thanks in advance for any help
Code:
'#08M2 Picaxe control for multiple Tenda boards for Witch conversations
symbol Aggie = C.0 'Tenda 1 RX
symbol Gertie = C.4 'Tenda 2 RX
symbol Aggie_BZ = pinC.1 'Tenda 1 Busy
symbol Gertie_BZ =pinC.3 'Tenda 2 busy
symbol Baud =T4800 'tenda baud Rate
Init: 'starting point
serout Aggie,Baud,($EF) 'stop tenda 1
serout Gertie, Baud, ($EF)'stop tenda 2
pause 10000 'wait 10 seconds
serout Aggie, Baud, ($E8) 'set tenda 1 volume
serout Gertie, Baud, ($E8) 'set tenda 2 volume
pause 60000 'wait 1 minute
Happy_Halloween:
serout Aggie,Baud,($01)
serout Gertie,Baud, ($01)
pause 1000
do while Aggie_BZ = 0
loop
serout Gertie, Baud, ($02)
pause 1000
do while Gertie_BZ = 0
loop
serout Aggie, Baud, ($03)
pause 1000
do while Aggie_BZ = 0
loop
serout Gertie, Baud, ($04)
pause 1000
do while Gertie_BZ = 0
loop
serout Aggie, Baud, ($05)
pause 1000
do while Aggie_BZ = 0
loop
serout Gertie, Baud, ($06)
pause 1000
do while Gertie_BZ = 0
loop
serout Aggie, Baud, ($07)
pause 1000
do while Aggie_BZ = 0
loop
Spellcast:
let w0 = time
random w0
w1 = w0//2+8
if w1 =2 then Its_Halloween
if w1 =3 then Tonight
if w1 =4 then Early_Early
if w1 =5 then MacBeth
if w1 =6 then Willoughby
Its_Halloween:
serout Gertie, Baud, ($F5,01)
pause 1000
do while Aggie_BZ = 0
loop
serout Gertie, Baud, ($F5,02)
pause 1000
do while Gertie_BZ = 0
loop
serout Aggie, Baud, ($F5,03)
pause 1000
do while Aggie_BZ = 0
loop
serout Gertie, Baud, ($F5,04)
pause 1000
do while Gertie_BZ = 0
loop
serout Aggie, Baud, ($F5,05)
pause 1000
do while Aggie_BZ = 0
loop
serout Gertie, Baud, ($F5,06)
pause 1000
do while Gertie_BZ = 0
loop
serout Aggie, Baud, ($F5,07)
pause 1000
do while Aggie_BZ = 0
loop
serout Gertie, Baud, ($F5,08)
pause 1000
do while Gertie_BZ = 0
loop
goto Happy_Halloween
Tonight:
serout Gertie, Baud, ($F3,01)
pause 1000
do while Aggie_BZ = 0
loop
serout Gertie, Baud, ($F3,02)
pause 1000
do while Gertie_BZ = 0
loop
serout Aggie, Baud, ($F3,03)
pause 1000
do while Aggie_BZ = 0
loop
serout Gertie, Baud, ($F3,04)
pause 1000
do while Gertie_BZ = 0
loop
serout Aggie, Baud, ($F3,05)
pause 1000
do while Aggie_BZ = 0
loop
serout Gertie, Baud, ($F3,06)
pause 1000
do while Gertie_BZ = 0
loop
goto Happy_Halloween
Early_Early:
serout Gertie, Baud, ($F2,01)
pause 1000
do while Aggie_BZ = 0
loop
serout Gertie, Baud, ($F2,02)
pause 1000
do while Gertie_BZ = 0
loop
serout Aggie, Baud, ($F2,03)
pause 1000
do while Aggie_BZ = 0
loop
serout Gertie, Baud, ($F2,04)
pause 1000
do while Gertie_BZ = 0
loop
serout Aggie, Baud, ($F2,05)
pause 1000
do while Aggie_BZ = 0
loop
serout Gertie, Baud, ($F2,06)
pause 1000
do while Gertie_BZ = 0
loop
serout Aggie, Baud, ($F2,07)
pause 1000
do while Aggie_BZ = 0
loop
serout Gertie, Baud, ($F2,08)
pause 1000
do while Gertie_BZ = 0
loop
goto Happy_Halloween
MacBeth:
serout Gertie, Baud, ($F4,01)
pause 1000
do while Aggie_BZ = 0
loop
serout Gertie, Baud, ($F4,02)
pause 1000
do while Gertie_BZ = 0
loop
serout Aggie, Baud, ($F4,03)
pause 1000
do while Aggie_BZ = 0
loop
serout Gertie, Baud, ($F4,04)
pause 1000
do while Gertie_BZ = 0
loop
serout Aggie, Baud, ($F4,05)
pause 1000
do while Aggie_BZ = 0
loop
serout Gertie, Baud, ($F4,06)
pause 1000
do while Gertie_BZ = 0
loop
serout Aggie, Baud, ($F4,07)
serout Gertie, Baud, ($F4,07)
pause 1000
do while Aggie_BZ = 0
loop
serout Gertie, Baud, ($F4,08)
pause 1000
do while Gertie_BZ = 0
loop
serout Gertie, Baud, ($F4,09)
pause 1000
do while Aggie_BZ = 0
loop
serout Gertie, Baud, ($F4,10)
pause 1000
do while Gertie_BZ = 0
loop
serout Aggie, Baud, ($F4,11)
pause 1000
do while Aggie_BZ = 0
loop
serout Aggie, Baud, ($F4,12)
serout Gertie, Baud, ($F4,12)
pause 1000
do while Aggie_BZ = 0
loop
serout Gertie, Baud, ($F4,13)
pause 1000
do while Gertie_BZ = 0
loop
serout Aggie, Baud, ($F4,14)
pause 1000
do while Aggie_BZ = 0
loop
serout Gertie, Baud, ($F4,15)
pause 1000
do while Gertie_BZ = 0
loop
serout Aggie, Baud, ($F4,16)
pause 1000
do while Aggie_BZ = 0
loop
serout Gertie, Baud, ($F4,17)
pause 1000
do while Gertie_BZ = 0
loop
serout Aggie, Baud, ($F4,18)
pause 1000
do while Aggie_BZ = 0
loop
serout Aggie, Baud, ($F4,19)
serout Gertie, Baud, ($F4,19)
pause 1000
do while Aggie_BZ = 0
loop
serout Gertie, Baud, ($F4,20)
pause 1000
do while Gertie_BZ = 0
loop
goto Happy_Halloween
Willoughby:
serout Gertie, Baud, ($F6,01)
pause 1000
do while Aggie_BZ = 0
loop
serout Gertie, Baud, ($F6,02)
pause 1000
do while Gertie_BZ = 0
loop
serout Aggie, Baud, ($F6,03)
pause 1000
do while Aggie_BZ = 0
loop
serout Gertie, Baud, ($F6,04)
pause 1000
do while Gertie_BZ = 0
loop
serout Aggie, Baud, ($F6,05)
pause 1000
do while Aggie_BZ = 0
loop
serout Gertie, Baud, ($F6,06)
pause 1000
do while Gertie_BZ = 0
loop
serout Aggie, Baud, ($F6,07)
pause 1000
do while Aggie_BZ = 0
loop
serout Gertie, Baud, ($F6,08)
pause 1000
do while Gertie_BZ = 0
loop
goto Happy_Halloween
Parts of the code do seem to be working as I intended. It does call up a file from one module, then the next file from the other and so on. However, a number of things are occuring (or not occuring).
1. The code is skipping over "Happy_Halloween" entirely and going right to "Spellcast".
2. It won't call up files on both modules at the same time, as is indicated in various sections of the code (Happy_Halloween, Macbeth).
3. It will call up the same file a couple of times before forwarding to next file (specifically in "Early_Early [$F2,07])
4. It always calls up "Early_Early" first, and will call it up multiple times
5. One of the Tenda modules is a third of the volume of the other. I have tried switching the SD cards and the 3.5mm jacks and it is the module (I realize I could have a bad module}.
Thanks in advance for any help