' {$STAMP BS1} ' {$PBASIC 1.0} '------------------------------------------------------ ' Ironstock Centerpiece ' "The Haunted Cabin" ' By Vern Graner Jun 24, 2005 ' Last update Jun 25, 2005 ' Any questions to vern@spiderspreyground.com '------------------------------------------------------ ' Designed for the Prop-1 controller driving servos, ' lights and sound. '------------------------------------------------------ ' Hardware setup: ' P0 - Flying Crank Ghost (Continuous rotation Servo) ' P1 - Jumping Spider (standard servo) ' P2 - Sound module ' P6 - Fading UV (blacklight) LEDs ' P7 - Trigger Button (with jumper for Pull-down resistor) '------------------------------------------------------ ' Define variables and symbols '------------------------------------------------------ SYMBOL FCG = 0 SYMBOL SPIDER = 1 SYMBOL SNDEFX = 2 SYMBOL LED = 6 SYMBOL Btn = 7 SYMBOL btnWrk = B2 SYMBOL I = W2 ' value can be 0 to 65535 Takes B4/B5 SYMBOL X = W3 ' value can be 0 to 65535 Takes B6/B7 '------------------------------------------------------ ' Reset all effects to off '------------------------------------------------------ AGAIN: ' stop the lights and sound LOW LED LOW SNDEFX 'Reset "Spider on a stick" :) FOR I = 1 TO 100 PULSOUT SPIDER, 42 PAUSE 20 NEXT '------------------------------------------------------ ' Wait for trigger to start the show '------------------------------------------------------ Main: BUTTON Btn, 1, 200, 20, btnWrk, 0, MAIN '------------------------------------------------------ ' Trigger detected, show begins here '------------------------------------------------------ HIGH LED 'Turn on the fading UV LEDs HIGH SNDEFX 'Turn on the Sound Effects PAUSE 1000 'Wait 1 second for sound to get going ' Continuous servo value table '127 fastCW '126 med cw '125 slow CW '124 stop '123 slow CCW '122 med CCW '121 fast CCW ' run the crank ghost FOR I = 1 TO 500 PULSOUT FCG, 123 PAUSE 20 NEXT 'Strobe LED on and off FOR I = 1 TO 30 PULSOUT FCG, 123 TOGGLE LED PAUSE 75 NEXT 'Jump Spider on a stick :) FOR I = 1 TO 100 PULSOUT SPIDER, 120 ' 90 degress 'PULSOUT SPIDER, 200 '180 degrees PULSOUT FCG, 123 PAUSE 20 NEXT 'Turn the LED on for fade cycle HIGH LED 'Reset Spider on a stick :) FOR I = 1 TO 50 PULSOUT SPIDER, 42 PULSOUT FCG, 123 PAUSE 20 NEXT ' run the crank ghost FOR I = 1 TO 300 PULSOUT FCG, 123 PAUSE 20 NEXT ' Slow rise the spider FOR I = 42 TO 120 PULSOUT SPIDER, I PULSOUT FCG, 123 PAUSE 20 NEXT 'Run the crank ghost while we wait.. FOR I = 1 TO 50 PULSOUT FCG, 123 PAUSE 20 NEXT ' Slow reset the spider FOR I = 120 TO 42 STEP -1 PULSOUT SPIDER, I PULSOUT FCG, 123 PAUSE 20 NEXT 'Shows over, go back to the button wait GOTO AGAIN END