Hi there I am starting to get to grips with GPIOs and python but have hit a syntax error. Please can someone correct my mistake so I can venture forth and If/then myself to the internet of things.
The err is:
pi@chickenpi:~ $ ./shut.py
File "./shut.py", line 26
if RCtime > 30000
^
SyntaxError: invalid syntax
pi@chickenpi:~ $
The code is based on the RCtime.py from adafruit as follows:
pi@chickenpi:~ $ cat shut.py
#!/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
print RCtime(18) # Read RC timing using pin #18
if RCtime > 30000
GPIO.setup(17, GPIO.OUT)
GPIO.output(17, True)
pi@chickenpi:~ $
So my syntax error is in the if statement at the bottom. Not sure what to do here.
Any help is gratefully received.
Regds...jules