Shop OBEX P1 Docs P2 Docs Learn Events
programming the sound app module — Parallax Forums

programming the sound app module

ArchiverArchiver Posts: 46,084
edited 2002-11-13 04:36 in General Discussion
Anyone got any experience working with a sound module appmod-revB?

I'm having trouble with my programming code. I am working with a
piezo electric sensor connected to pin3 of a BS2 (board of education.
When the sensor is pressed the sound module should play a recorded
message. I started off recording three messages on the sound module
with this code:
x var byte
Init: pause 500
serout 4, 84+$8000,[noparse][[/noparse]"!SM0N"]
pause 500
Start: for x=0 to 3
serout 4,84+$8000,[noparse][[/noparse]"!SM0R",(x*5)]
pause 2000
serout 4,84+$8000,[noparse][[/noparse]"!SM0E"]
pause 1000
serout 4,84+$8000,[noparse][[/noparse]"!SM0P",(x*5)]
pause 2000
next
for x=0 to 3
serout 4,84+$8000,[noparse][[/noparse]"!SM0P",(x*5)]
pause 2000
next

serout 4,84+$8000,[noparse][[/noparse]"!SM0D"]
end

so now there are three messages stored in the sound app's memory.
then i ran the code to program the sound module to react to the
sensor being pressed:
Input 3 'constant
Output 4 'constant
LOOP:
if In3=0 then PLAYAUDIO
GOTO LOOP:

PLAYAUDIO:

serout 4,188+$8000,[noparse][[/noparse]"!SM0P",0]
debug "sensor is pressed"
GOTO LOOP:
end

However, there is no audio playback when i press the sensor
but "sensor is pressed" does appear in the debug window. Any good
programmers out there know how to make the audio playback?
Thanks for any and all help!!
Sign In or Register to comment.