# Picaxe controlled Witch



## Dead Things (Apr 4, 2009)

Here is a vid on the components that make up Aggie Weirding






The finished Prop can be seen here
http://www.hauntforum.com/showthread.php?t=29260


----------



## HalloweenRick (Nov 25, 2005)

Great job on that! Love the arm movements! Two questions for you:
A)Could I see the PICAXE code for that?
B) How difficult was it getting the servos to work with the PICAXE chip
Thanks!


----------



## Dead Things (Apr 4, 2009)

The servos are controlled using the Pololu micromaestro and have no connection with the Picaxe. The picaxe controls the three vent motors and the SD card module.
Here is the code I used. Parts were borrowed from Halstaff and from the Picaxe forum
Code
_____________________________________________


#Picaxe 18M2
'Witch Prop

symbol PIR= B.7 `PIR sensor
symbol TENDA=B.3 `Tenda RXD `
symbol Debounce=b18
symbol BAUD=T4800
symbol Wait_If_Busy=pinB.1 `Tenda Busy Line
symbol Magic_Hand=C.0
symbol Elbow=C.6
symbol Shoulder=C.7

Start0:


let w0 = time
random w1
pause w2

Init0: 'Staring point to setup all inputs, outputs and set variables

serout TENDA,BAUD, ($EF); 'STOP MP3 module 
pause 10000
serout TENDA,BAUD, ($E0) `set Tenda Volume off
pause 60000 'one minute pause to let PIR settle down


Main0:
serout TENDA, BAUD, ($E8) 'set Tenda volume
debounce=0
Do
if Wait_If_Busy=1 then '0=playing, 1=stopped
serout TENDA, Baud, ($F2,01) `play Track 1, Folder 2
pause 1000 'give Tenda time to start playing track
endif
readadc PIR,debounce 
Loop While debounce<50 ' exit loop if PIR triggered

Open_chant:
Pause 1000
serout TENDA,BAUD,($F2,02) 'play cackle,Track 2, folder 2
do while Wait_If_Busy=0 'wait until track ends 
loop

Spellcast: 
serout TENDA,BAUD,($00) 'random selection of verses
pause 1000
do while Wait_If_Busy=0 'wait until track ends 
loop

Cauldron:
random w1 'stir the pot
serout TENDA,Baud,($F2,03) 'play cauldron track, Folder 2,file 10
pause 1000 
w2=w1//30000+65000 'generate random pause between 30 and 60 seconds before retrigger 
pause w2
serout TENDA,BAUD, ($EF); 'STOP MP3 module 
goto Main0


Start1:


do
High Magic_Hand
random w3
w4=w3//1000 + 5000 'random ON time between 1 and 5 seconds
pause w4
Low Magic_Hand
random w3
w4=w3//1000 + 5000 'random OFF time between 1 and 5 seconds
pause w4
loop
Start2:
do
High Elbow
random w5
w6=w5//1000 + 5000 'random ON time between 1 and 5 seconds
pause w6
Low Elbow
random w5
w6=w5//1000 + 5000 'random OFF time between 1 and 5 seconds
pause w6
loop
Start3:
do
High Shoulder
random w7
w8=w7//1000 + 5000 'random ON time between 1 and 5 seconds
pause w8
Low Shoulder
random w7
w8=w7//1000 + 5000 'random OFF time between 1 and 5 seconds
pause w8
loop
___________________________________________
End Code


----------



## DeathTouch (Sep 6, 2005)

MIght want to remind everyone that the site you was talking about is Halloween2go. Don't do Halloweento or you will get slap and tickle stuff. Which isn't bad, mind you, but not all would like that. You will need more than a hot shower if you type in that address. LOL


----------

