global [songon]

 

to start

curtain

house

play-song

end

 

to curtain

waituntil [ switch 7 ] a, onfor 110

end

 

to house

b, setpower 3 on thatway c, on thisway waituntil [(sensor 1) > 150] c, off waituntil [(sensor 0) > 150] b, off

end

 

to play-song

setsongon 1

beethoven

end

 

to stop-song

setsongon 0

end

 

to beethoven

loop[

wait 6

play_note 90 5 1

play_note 90 4 1

play_note 87 1 1

play_note 88 2 1

play_note 90 3 1

play_note 87 4 2

play_note 87 1 1

play_note 87 2 1

play_note 85 3 1

play_note 83 4 2

play_note 87 1 1

play_note 87 2 1

play_note 85 3 1

play_note 83 4 4

play_note 90 5 1

play_note 90 4 1

play_note 87 1 1

play_note 88 2 1

play_note 90 3 1

play_note 93 3 1

play_note 92 3 1

play_note 90 5 1

 

 

]

end

 

to play_note :frequency :duration :wait

if songon

[note :frequency :duration

wait :wait]

if ( switch 8 ) [ a, thatway onfor 80

stop-song ]

 

end

 

Return to Wizard of Oz Introduction and Table of contents