'idog2.bas 152 bytes out of 256 'I/O allocation 'OUT/SERIALOUT pin 0 'IN/OUT/ADC1 pin 1 CDS light sensor 'IN/OUT pin 2 close speaker 'INput pin 3 push button on board 'IN/OUT pin 4 nose button activation 'serport gosub to allow adc value to be viewed in real time. symbol light = w1 symbol tickle = b4 input 1 tickle = 0 start: pause 1000 readadc10 1,light gosub serport if light > 100 then wakeup pause 1000 readadc10 1,light if light < 100 then gosleep wakeup: gosub nose if tickle = 50 then nosetickle random w0 pause w0 gosub serport random w0 pause w0 gosub serport random w0 pause w0 gosub serport goto start nosetickle: tickle = 0 gosub speaker goto start gosleep: high 4 pause 7000 low 4 gosub speaker tickle = 0 dream: pause 2000 readadc10 1,light gosub serport if light < 100 then dream gosub nose gosub speaker goto start nose: high 4 pause 200 low 4 tickle = tickle +1 'count nose tickles return speaker: high 2 pause 10000 low 2 return serport: sertxd ("random=",#w0," light=",#light," nose=",#tickle,13,10) return end