raspberry gpio tutorial 2.. getting input using switch in tamil

python codings

import RPi.GPIO as GPIO
import time

GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(17,GPIO.IN)
while 1:
    if GPIO.input(17):
        print 'button pressed'
        time.sleep(1)
    else:
        print 'button not pressed'
        time.sleep(1)
        
***************************************************************************************************************
copy that and paste in your python idle




Comments

Popular posts from this blog

raspberry gpio tutorial 5...control LED using ultrasonic in tamil

arduino controlled motor and servo in tamil

Arduino - millis() in tamil