'BasicStamp code to '1) wait for signal from computer '2) check furnace and AC status '3) report back to computer '4) display diagnostic information b0 = 1 'reset output state bit0 = 1 'lock output to send at least a 1 '0 causes problems with the perl script INPUT 7 'cooling INPUT 6 'heating OUTPUT 0 'LCD display / debugging OUTPUT 1 'Tx to PC INPUT 2 'Rx from PC serout 0, N2400, (254,1) 'Clear LCD screen loop: serin 2, N2400, ("A") 'Wait for signal from PC furnace: bit1 = 1 'assume furnace is on pulsin 7, 1, w5 'detect presence of 60Hz signal if w5 > 500 then skipheat bit1 = 0 'no signal, furnace is off skipheat: ac: bit2 = 1 pulsin 7, 1, w5 if w5 > 500 then skipac bit2 = 0 skipac: sendresult: serout 1, N2400, (#b0) 'send bit flags 00000CH1 lcd: serout 0, N2400, ("H", #b0) 'display status on LCD 'do it all over goto loop