' {$STAMP BS1} ' {$PBASIC 1.0} ' -----[ I/O Definitions ]------------------------------------------- ' Serial connections SYMBOL PIR=7 SYMBOL ChipCorder=5 SYMBOL RC4sio = 4 SYMBOL WitchVoice = 3 ' Devices on the RC4 controller SYMBOL RC4Blklight = 1 SYMBOL RC4Fog = 2 SYMBOL RC4Popup = 3 SYMBOL RC4Fan = 4 ' RC4 Settings SYMBOL RC4baud = OT2400 SYMBOL RC4addr = %11 SYMBOL IsOn = 1 SYMBOL IsOff = 0 SYMBOL COUNTER=W2 SYMBOL TriggerDelay=3000 ' delay between motion detected and start SYMBOL Resettime=60000 ' delay before prop reset SYMBOL P1=20000 ' delay P1 -20 seconds SYMBOL P2=10000 ' delay P2 -10 seconds SYMBOL P3=7000 ' delay P3 -7 seconds ' -----[ Initialization ]-------------------------------------------- SEROUT RC4sio, RC4baud, ("!RC4", RC4addr, "X") ' turn off all relays PAUSE 10000 ' pause 10 seconds (wait for uMP3 to initialize) SEROUT Witchvoice, RC4baud, ("PC F /SOUNDS/WARMUP.MP3",13) 'DEBUG CLS ' Clear DEBUG Screen FOR counter = 30 TO 0 STEP -1 ' Wait another 30 Seconds For PIR Warm-Up 'DEBUG "IR Ready in:", counter 'print how much time left PAUSE 1000 ' Display Counter Every Second 'DEBUG CLS ' Clear DEBUG Screen NEXT counter = 0 ' Clear Counter Variable 'DEBUG "WAITING... " ' Display Waiting Message ' -----[ Program Code ]----------------------------------------- WaitForMotion: PAUSE 20 IF PIN7 <> 1 THEN WaitForMotion ' Motion Detected? ' DEBUG "TRIPPED..." ' motion detected PropSequence: ' Wait 5 seconds ' Start witch speech ' Wait 'P1' seconds ' Turn on black lights ' Wait 'P2' seconds ' Turn on Fog Machine ' Wait 5 seconds ' Turn on Fans ' Wait 'P3' seconds ' Trigger Chipcorder sound ' Wait 5 seconds ' Trigger Popup(solenoid) ' Wait 20 seconds ' Turn off Popup, Fog Machine, Fans, Lights ' Wait 60 seconds before restarting sequence PAUSE Triggerdelay SEROUT Witchvoice, RC4baud, ("PC F /SOUNDS/STORY.MP3", 13) PAUSE P1 SEROUT RC4sio, RC4baud, ("!RC4", RC4addr, "R", RC4Blklight, IsOn) PAUSE P2 SEROUT RC4sio, RC4baud, ("!RC4", RC4addr, "R", RC4Fog, IsOn) PAUSE 5000 ' 5 second delay SEROUT RC4sio, RC4baud, ("!RC4", RC4addr, "R", RC4Fan, IsOn) PAUSE P3 HIGH ChipCorder PAUSE 5000 SEROUT RC4sio, RC4baud, ("!RC4", RC4addr, "R", RC4Popup, IsOn) PAUSE 20000 SEROUT RC4sio, RC4baud, ("!RC4", RC4addr, "X") ' turn off all relays PAUSE Resettime GOTO WaitForMotion