Advertisement
Guest User

simple_flow_test.py

a guest
Jul 9th, 2015
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.66 KB | None | 0 0
  1. #!/usr/bin/env python
  2.  
  3. #
  4. # Flowmeter - read from the FT330 flow meter
  5. # and determine the volume of a pour.
  6. #
  7. # Black to ground
  8. # Red to 5V
  9. # 10K pull-up from white to 5V
  10. # White to GPIO pin 23
  11. #
  12.  
  13. # Uses header pin 16 (GPIO 23), ground, and 5V.
  14.  
  15. import RPIO as GPIO
  16.  
  17. flowSensorPin = 23
  18. GPIO.setmode(GPIO.BCM)
  19. # GPIO.setup(flowSensorPin, GPIO.IN, pull_up_down = GPIO.PUD_DOWN)
  20. GPIO.setup(flowSensorPin, GPIO.IN)
  21.  
  22. #
  23. # Super simple code to test state transitions to ensure that the
  24. # flow sensor is working.
  25. #
  26.  
  27.  
  28. while True:
  29.   state = GPIO.input(flowSensorPin)
  30.   if state == GPIO.HIGH:
  31.     print "HIGH"
  32.   else:
  33.     print "                   low"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement