Henrik, you are correct ! I had it close and didn't even realize it. The code below seems to work exactly like I want it to. Just need to add an output for a relay now.
I've been wanting to learn how to use a pot for things like this for a long time, I have other uses for it now too.
Thanks VERY much for your help, I really appreciate it,
Sam
Adjust pot for desired water flow rate
Code:
CMCON=�000111
ANSEL=�000000
@ DEVICE pic12F675, INTRC_OSC_NOCLKOUT
@ DEVICE pic12F675, WDT_ON
@ DEVICE pic12F675, PWRT_ON
@ DEVICE pic12F675, MCLR_OFF
@ DEVICE pic12F675, BOD_ON
define ADC_BITS 8
define ADC_CLOCK 3
rdpot var word
c var byte
pulse var word
Green var GPIO.2
Red Var GPIO.0
low Red
Low Green
PAUSE 50
flow:
count GPIO.4, 500, pulse
adcin 1,rdpot
if PULSE > RDPOT then
high Green
low RED
goto flow
else
GOSUB ALERT
endif
pause 50
goto flow
alert:
for c = 1 to 4
low Green
high Red
pause 100
low Red
pause 500
next
Bookmarks