Fox Smart A/C Controller Listing 2 LISTING 2 This program is for the PICAXE-08M processor it insures that the 'compressor is protected with a 5 or 3 minute delay 'compressor is controlled by pin 2 and LED by pin 1 'uses B0,B1,B2,W6 'Pin3 = Compressor signal. 'Pin4 = Time delay signal '6/19/2008 tested ver 1.1 '===Directives=== #com1 ;specify which com port #picaxe 08M ; specify which PICAXE chip '=== Main Program ============= 'uses B0,B1,B2,W6 'Pin3 = Compressor signal 'Pin4 = Time delay signal symbol Compressor = b0 'state of compressor symbol ComOn = 1 'constant symbol ComOff = 0 'constant testing: low 1 'blink compressor led for visual test pause 250 high 1 pause 250 low 1 pause 250 high 1 pause 250 main:low 2 'compressor pin; Off on start up low 1 'LED pin; Off on start up Compressor = ComOff 'compressor state; Off on start up pause 50 do 'Only turn off compressor and LED if compressor is on if pin3 = 0 and Compressor = ComOn then low 2 low 1 Compressor = ComOff endif 'Only turn on compressor and LED if compressor is off if pin3 = 1 and Compressor = ComOff then gosub OnCompressor endif pause 50 loop OnCompressor: 'delay either 3 or 5 minutes(default) for w6 = 1 to 600 if pin4 = 1 then pause 200 endif pause 300 B2 = w6 % 2 if B2 = 1 then high 1 endif if B2 = 0 then low 1 endif if pin3 = 0 then low 1 Compressor = ComOff return endif next w6 'turn on compressor high 2 'turn on LED high 1 Compressor = ComOn return end