; Dj ; motor a drives record ; motor b drives the arm of the DJ ; motor c drives the light ; switch 7 is a touch sensor ; for each song, the DJ & dancers do the following: ; a. DJ puts down his arm, when touch sensor is touched, ; he sends a ready signal for to the dancers, light ; goes on. ; b. dancers come forth and stop; DJ waits for s1, lifts ; his arm. ; c. DJ puts down arm again and hit the touch sensor. ; d. send start signal to the pair. music, record, and ; lift the arm. ; e. when music stops, stop everything including the light. wait f1 for ; the pair to finish up, then repeat the same process for the next pair. global [ready1 start1 ready2 start2 ready3 start3 s1 f1 s2 f2 s3 f3 stopit count here go] ; set global variables to init sets1 45 setf1 45 sets2 45 setf2 45 sets3 45 setf3 45 setready1 10 setstart1 11 setready2 12 setstart2 13 setready3 14 setstart3 15 setstopit 0 setcount 0 rec setpower 1 setgo 50 ; for synch barriers sethere 60 end to test init do-it 2 end to dance-in-sequence init loop [ do-it count setcount (count \ 3) + 1 ] end to dance-randomly init loop [ setcount (random 3) + 1 do-it count ] end ; synch barrier, won't proceed until it receives "here" infrare from the cricket to hb-synch waituntil [ir = here] irsend go end to do-it :num if (:num = 1) [dance ready1 start1 s1 f1 1] if (:num = 2) [dance ready2 start2 s2 f2 2] if (:num = 3) [dance ready3 start3 s3 f3 3] end to dance :ready :start :s :f :which-song arm-down waituntil [touch?] irsend :ready ; ready signal, dancers light on arm-up wait :s arm-down waituntil [touch?] irsend :start choose-dance :which-song wait :f end to choose-dance :num rec on arm-up if (:num = 1) [strauss setstopit 1] if (:num = 2) [twist-and-shout setstopit 1] if (:num = 3) [macarena setstopit 1] waituntil [stopit = 1] rec off light off setstopit 0 end to arm-down arm thatway onfor 5 end to arm-up arm thisway onfor 4 end to strauss note 60 2 wait 1 note 60 2 wait 1 note 64 2 wait 1 note 67 2 wait 1 note 67 5 wait 1 note 67 1 wait 2 note 67 2 wait 4 note 64 1 wait 2 note 64 3 wait 4 ;hb-synch note 60 2 wait 1 note 60 2 wait 1 note 64 2 wait 1 note 67 2 wait 1 note 67 5 wait 1 note 67 1 wait 2 note 67 2 wait 4 note 65 1 wait 2 note 65 3 wait 4 ;hb-synch note 59 2 wait 1 note 59 2 wait 1 note 62 2 wait 1 note 69 2 wait 1 note 69 5 wait 1 note 69 1 wait 2 note 69 2 wait 4 note 65 1 wait 2 note 65 3 wait 4 ;hb-synch note 59 2 wait 1 note 59 2 wait 1 note 62 2 wait 1 note 69 2 wait 1 note 69 5 wait 1 note 69 1 wait 2 note 69 2 wait 4 note 64 1 wait 2 note 64 3 wait 4 ;hb-synch note 60 2 wait 1 note 60 2 wait 1 note 64 2 wait 1 note 67 2 wait 1 note 72 5 wait 1 note 72 1 wait 2 note 72 2 wait 4 note 67 1 wait 2 note 67 3 wait 4 ;hb-synch note 60 2 wait 1 note 60 2 wait 1 note 64 2 wait 1 note 67 2 wait 1 note 72 5 wait 1 note 72 1 wait 2 note 72 2 wait 4 note 68 1 wait 2 note 68 3 wait 4 ;hb-synch note 62 2 wait 1 note 62 2 wait 1 note 65 2 wait 1 note 69 2 wait 1 note 69 7 wait 1 note 66 2 wait 1 note 67 2 wait 1 note 76 7 wait 1 note 67 2 wait 1 note 64 2 wait 1 note 64 4 wait 1 note 62 1 wait 2 note 69 4 wait 1 note 67 1 wait 2 note 60 2 wait 1 note 60 1 note 60 1 end to twist-and-shout repeat 2 [ repeat 3 [ note 75 1 wait .5] ; shake it up baby! note 77 1 wait 1.5 note 74 1 wait 2.5 repeat 3 [ note 67 1 wait .5] ; shake it up baby! repeat 2 [ note 69 1.5 wait 1] wait 4 repeat 2 [ note 75 1 wait 1.5] ; twist and note 74 2 wait 4 ; shout! repeat 2 [ note 67 1 wait .5] wait 1 ; twist and note 69 2 wait 5 ; shout! repeat 4 [ note 75 1 wait .5] wait 3; come on repeat 2 [note 75 1 wait 1] ; note 77 1 wait 1.5 note 74 1 wait 2 ; baby now repeat 2 [ note 67 1 wait 1] wait 2 ; comon note 69 1.5 wait 1 note 69 .5 wait 1 ; baby note 73 1 wait .5 note 72 1 wait .5 ; let me note 73 1 wait .5 note 72 1 wait .5 ; know note 70 1 wait .5 note 69 1 wait .5 ; that you're note 72 1 wait .5 note 70 1 wait 4 ; mine! repeat 2 [note 67 1 wait .5] wait .5 ; 'know you're note 69 1.5 wait 10 ; mine ! ] end to macarena repeat 2 [ repeat 3 [ note 72 2 wait 1 note 72 1 note 72 1 wait 1] note 72 1 wait 1 note 76 1 wait 4 repeat 3[ note 72 2 wait 1 note 72 1 note 72 1 wait 1] note 69 1 wait 1 note 67 1 wait 4 repeat 3[ note 72 2 wait 1 note 72 1 note 72 1 wait 1] note 72 1 wait 1 note 76 1 wait 4 note 79 7 wait 2 note 76 1 note 79 1 wait 1 note 76 1 note 72 1 wait 14 ] end to rec a, end to arm b, end to light c, end to touch? output switch 7 end