Working Pump Code

I need a working pump code, fast. Can anyone post a real working copy? Thanks in advance.

-Dan

'Place this in the main loop
gosub Comp_Switch:

'Place this below the main loop
Comp_Switch:

if rc_sw2 = 0 then low_pres: 'Compressor switch
comp_on = 0 'counter variable
relay1_fwd=1
relay1_rev=0
return

low_pres:
if(comp_on = comp_off) then compress_off: 'comp_off is set
'to 120. try other
'values to see which you like.
'Still not sure whcih value we’ll use
relay1_fwd=1
relay1_rev=0
comp_on = comp_on + 1
return

compress_off: 'Deactivate Compressor
relay1_fwd=0
relay1_rev=0
return

Hope it helps. This assumes that you are going into digital inputs 2 and 6.