Hello paddy,
Thanks for your code, I tried the following code for the flow sensor
import RPi.GPIO as GPIO
import time, sys
FLOW_SENSOR = 23
GPIO.setmode(GPIO.BCM)
GPIO.setup(FLOW_SENSOR, GPIO.IN, pull_up_down = GPIO.PUD_UP)
global count
count = 0
def countPulse(channel):
global count
count = count+1
print(count);
GPIO.add_event_detect(FLOW_SENSOR, GPIO.FALLING, callback=countPulse)
while True:
try:
time.sleep(1)
except KeyboardInterrupt:
print('\ncaught keyboard interrupt!, bye')
GPIO.cleanup()
sys.exit()
while executing above code it showed the error in line 7 and also Run time error. please find the image for the clear picture of the error.
And I have one more question. What is the maximum number of temperature sensors(ds18b20) can i mount on raspberry pi? Right now I need to mount 14 temperature sensors. Is it possible to mount 14 sensors on that? Whenever I try to pull up all sensors on the screen by using cd /sys/bus/w1/devices it only shows 10 or sometimes 11, and the 11 sensor will show up very rarely. What should I do in such a case.
Thanks in advance'
Vikas