Hi,
As far as I can see you've already done it.
You have your pot, which you read with ADCIN and get a value in rdpot, then you have your sensor which read with count and get a value in pulse. Then just do
Code:
Flow:
COUNT GPIO.1, 500, pulse
ADCIN 1, rdpot
IF pulse < rdpot THEN ' Compare pulse with rdpot
' Flow is under limit
' Do what needs to be done.
ELSE
' Flow is OK
ENDIF
Goto Flow
Or you can use a series of IF-THEN to light up the various LEDs or perhaps SELECT CASE, like
Code:
' rdpot sets the absolute low limit = red ligtht and stop
SELECT CASE pulse
pulse is < rdpot
' Stop and turn on red LED
pulse is < (rdpot * 2)
' Turn on yellow LED
pulse is < (rdpot * 4)
'Turn on Green LED
END SELECT
Something like that (untested). To be honest, when I think about it I'm not exactly sure how SELECT CASE works in this case. I mean when pulse < rdpot all cases are true and I'm not sure if it only executes the first the one and then exits (which is what we want) or if it continues to evauluate the other cases as well. Worth a try peraps.
/Henrik.
Bookmarks