This code will take button press down input from GPIO pin 11 and LED output to pin 15.
BreadBoard Setup
PIN Mapping
Pi 11 = Wedge GP17
Pi 15 = Wedge GP22
Python Code:
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BOARD)
GPIO.setup(11,GPIO.IN,pull_up_down=GPIO.PUD_DOWN)
GPIO.setup(15,GPIO.OUT)
GPIO.output(15,0)
try:
while True:
if(GPIO.input(11) == 1):
GPIO.output(15,1)
else:
GPIO.output(15,0)
except KeyboardInterrupt:
GPIO.cleanup()
BreadBoard Setup
PIN Mapping
Pi 11 = Wedge GP17
Pi 15 = Wedge GP22
Python Code:
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BOARD)
GPIO.setup(11,GPIO.IN,pull_up_down=GPIO.PUD_DOWN)
GPIO.setup(15,GPIO.OUT)
GPIO.output(15,0)
try:
while True:
if(GPIO.input(11) == 1):
GPIO.output(15,1)
else:
GPIO.output(15,0)
except KeyboardInterrupt:
GPIO.cleanup()
Thanks for giving the information it is useful for me.
ReplyDeleteCrafsol develop the mobile application for mobile devices by using the SAP technology.
Enterprise Mobility