symbol ir_led = 2 symbol ir_sens = 3 symbol red_led = 1 symbol swtch = 4 symbol piezo = 0 setint %00010000,%00010000 start: debug let b1 = 0 goto main main: if b1 = 0 then main pause 1250 pause 1250 if b1 > 0 and b1 < 4 then confirm goto main confirm: setint off pwmout 2,25,84 if b1 = 2 then goto silent_confirm else goto beep endif beep: for b2 = 1 to b1 high red_led sound piezo,(50,30) low red_led pause 30 next b2 if b1 = 1 then placement_time goto detect placement_time: pause 9000 high red_led sound piezo,(50,30) low red_led goto detect silent_confirm: for b3 = 1 to 2 high red_led pause 100 low red_led pause 150 next b3 pause 9000 for b4 = 1 to 2 high red_led pause 100 low red_led pause 150 next b4 goto detect address0: goto start detect: if pin3 = 0 then alert goto detect alert: branch b1,(address0,standard,silent,announce) standard: high red_led sound piezo,(124,75) low red_led sound piezo,(48,75) goto standard silent: pause 60000 pwmout 2,off goto pulse pulse: for b5 = 0 to 255 step 2 pwm 4,b5,1 next b5 for b5 = 255 to 0 step -2 pwm 4,b5,1 next b5 pause 1600 goto pulse announce: high red_led sound piezo,(124,850) low red_led goto detect interrupt: pause 100 if pin4 = 1 then interrupt let b1 = b1 + 1 setint %00010000,%00010000 return