Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- #
- # Flowmeter - read from the FT330 flow meter
- # and determine the volume of a pour.
- #
- # Black to ground
- # Red to 5V
- # 10K pull-up from white to 5V
- # White to GPIO pin 23
- #
- # Uses header pin 16 (GPIO 23), ground, and 5V.
- import RPIO as GPIO
- flowSensorPin = 23
- GPIO.setmode(GPIO.BCM)
- # GPIO.setup(flowSensorPin, GPIO.IN, pull_up_down = GPIO.PUD_DOWN)
- GPIO.setup(flowSensorPin, GPIO.IN)
- #
- # Super simple code to test state transitions to ensure that the
- # flow sensor is working.
- #
- while True:
- state = GPIO.input(flowSensorPin)
- if state == GPIO.HIGH:
- print "HIGH"
- else:
- print " low"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement