'{$STAMP BS2} '-------------------------------------------------------------------------- ' ' 2 erreurs: il manque un connecteur 12v et le button est mal connecté: il manque une resistance(voir BS2 manual) ' ----------[ Title ]------------------------------------------------------ ' ' File........... Jona.bs2 ' Author......... Thomas Charveriat ' E-mail......... tc262@columbia.edu ' Sound Design... Denis Menard ' E-mail......... denism79@hotmail.com ' Steel Drawing.. Frank Plant ' Lab Research... Mustafa Boughrousi ' E-mail......... mustabcn@yahoo.es ' Lab Support.... Nuria Perpiña ' WWW............ http://www.montcada5.com ' Date........... January 2003 ' ' ----------[ Program Description ]---------------------------------------- ' Steel Sculpture of a pissing woman. The eyes and the mouth moves via servo motors. ' ----------[ Diagram ]---------------------------------------------------- ' ' __________ ' SER TX <-| 1 24 |-- PWR ' SER RX ->| 2 23 |-- (PWR) GND ' SER ATN ->| 3 22 |-- RESET ' SER GND --| 4 21 |-- +5V 'Serial OUT to servos I/O 0 <-| 5 20 |-- I/O 15 N/C ' 12V Relay(PUMP) I/O 1 <-| 6 19 |-- I/O 14 N/C ' Relay() I/O 2 <-| 7 18 |-- I/O 13 N/C ' Relay() I/O 3 <-| 8 17 |-- I/O 12 N/C ' LED I/O 4 <-| 9 16 |-- I/O 11 N/C ' BUTTON I/O 5 ->| 10 15 |-- I/O 10 N/C ' N/C I/O 6 --| 11 14 |-- I/O 9 N/C ' N/C I/O 7 --| 12 13 |-- I/O 8 N/C ' |__________| ' ' BS2-IC ' ' =========================================================================== ' [ Variables ] ' =========================================================================== pos VAR Byte posm VAR Byte n VAR Byte speedmouth VAR Byte speedeyes VAR Byte speedmouth=10 '10 is a good speed speedeyes=45 '45 is a good speed ' =========================================================================== ' [ Constants ] ' =========================================================================== Servos CON 0 Pump CON 1 Play_Mp3 CON 2 Stop_Mp3 CON 3 Mouth CON 1 Eyes CON 0 ' =========================================================================== ' [ Initialization ] ' =========================================================================== 'DEBUG "reset" 'gosub Pee GOSUB MoveEyes PAUSE 500 LOW Stop_Mp3:PAUSE 150:HIGH Stop_Mp3 PAUSE 500 LOW Play_Mp3:PAUSE 150:HIGH Play_Mp3 'starts the Mp3 player PAUSE 2000 LOW Stop_Mp3:PAUSE 150:HIGH Stop_Mp3 PAUSE 200 PAUSE 3000 ' =========================================================================== ' [ Main Code ] ' =========================================================================== Check_Button: IF IN5=0 THEN Begin HIGH 4:PAUSE 150:LOW 4:PAUSE 50 GOTO Check_Button Begin: PAUSE 500 GOSUB Pee PAUSE 500 GOSUB MoveEyes PAUSE 500 LOW Stop_Mp3:PAUSE 150:HIGH Stop_Mp3 PAUSE 500 LOW Play_Mp3:PAUSE 150:HIGH Play_Mp3 'starts the Mp3 player again for a good synchronisation PAUSE 500 GOSUB MoveMouth 'Is anybody looking? GOSUB MoveMouth PAUSE 40 GOSUB MoveMouth PAUSE 960 GOSUB MoveEyes PAUSE 300 GOSUB MoveEyes PAUSE 2200 GOSUB MoveMouth 'Is anybody coming? GOSUB MoveMouth PAUSE 50 GOSUB MoveMouth PAUSE 300 GOSUB MoveEyes PAUSE 4000 GOSUB MoveEyes PAUSE 3000 GOSUB MoveMouth 'Noone is coming are you sure? PAUSE 50 GOSUB MoveMouth PAUSE 20 GOSUB MoveMouth GOSUB MoveMouth PAUSE 1800 GOSUB Pee PAUSE 1000 GOSUB MoveMouth 'Are you sure nobody is coming are you sure? GOSUB MoveMouth GOSUB MoveMouth GOSUB MoveMouth GOSUB MoveMouth GOSUB MoveMouth PAUSE 300 GOSUB MoveEyes PAUSE 500 GOSUB MoveEyes PAUSE 2000 GOSUB MoveMouth 'Is anybody looking? GOSUB MoveMouth PAUSE 10 GOSUB MoveMouth PAUSE 3500 GOSUB MoveMouth 'Can anybody see? GOSUB MoveMouth PAUSE 10 GOSUB MoveMouth PAUSE 2200 GOSUB Pee PAUSE 4500 GOSUB MoveMouth 'Are you sure no one is coming? GOSUB MoveMouth GOSUB MoveMouth GOSUB MoveMouth GOSUB MoveMouth GOSUB MoveMouth GOSUB MoveMouth PAUSE 5000 LOW Stop_Mp3:PAUSE 150:HIGH Stop_Mp3 GOTO Check_Button ' =========================================================================== ' [ Subroutines ] ' =========================================================================== MoveMouth: FOR POs=125 TO 140 STEP 2 '125=mouth closed 140=mouth opened SEROUT Servos,16468,[255,1,pos] PAUSE speedmouth NEXT FOR pos=140 TO 125 STEP 2 SEROUT Servos,16468,[255,1,pos] PAUSE speedmouth NEXT RETURN MoveEyes: FOR n=0 TO 2 'moves the eyes 2 times FOR posm=130 TO 122 STEP 1 pos= 238-posm SEROUT Servos,16468,[255,0,-pos] PAUSE speedeyes NEXT FOR posm=122 TO 130 STEP 1 '-124=eyes towards the corner -114=eyes towards the center pos= 238-posm SEROUT Servos,16468,[255,0,-pos] PAUSE speedeyes NEXT NEXT RETURN Pee: HIGH Pump:PAUSE 2000:INPUT Pump RETURN LookStraight: FOR posm=120 TO 128 STEP 1 '-124=eyes towards the corner -114=eyes towards the center pos= 238-posm SEROUT Servos,16468,[255,0,-pos] PAUSE speedeyes NEXT RETURN LookSide: FOR posm=128 TO 120 STEP 1 pos= 238-posm SEROUT Servos,16468,[255,0,-pos] PAUSE speedeyes NEXT RETURN