raspberry gpio tutorial 3..control LED using button in tamil
python codings
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(17,GPIO.IN)
GPIO.setup(27,GPIO.OUT)
while 1:
if GPIO.input(17):
GPIO.output(27,GPIO.LOW)
print 'led off'
time.sleep(1)
else:
GPIO.output(27,GPIO.HIGH)
print 'led on'
time.sleep(1)
*********************************************************************************
copy that and paste in your python idle
Comments
Post a Comment