Adafruit Basic Resistor Sensor Reading on Raspberry Pi
I checked against the low level peripheral wiki page. Does the 3.3v pin have a special name? Could someone break down for me where the output pin is defined?
If the output pin = RCpin then is there something else I should be reading to get pin names or just a better understanding?
Code: Select all
#!/usr/bin/env python # Example for RC timing reading for Raspberry Pi # Must be used with GPIO 0.3.1a or later - earlier verions # are not fast enough! import RPi.GPIO as GPIO, time, os DEBUG = 1 GPIO.setmode(GPIO.BCM) def RCtime (RCpin): reading = 0 GPIO.setup(RCpin, GPIO.OUT) GPIO.output(RCpin, GPIO.LOW) time.sleep(0.1) GPIO.setup(RCpin, GPIO.IN) # This takes about 1 millisecond per loop cycle while (GPIO.input(RCpin) == GPIO.LOW): reading += 1 return reading while True: print RCtime(18) # Read RC timing using pin #18