Question: How do we write background, wiring and code explanation of lab reading a push button # ! / usr / bin / env python import
How do we write background, wiring and code explanation of lab reading a push button
#usrbinenv python
import
LEdPin # pin
LedPin
ButtonPin
GPIO.setwarnings False
GPIO.setmodeGPIOBCM # Numbers GPIOs by standard marking
GPIO.setupLedPin GPIO.OUT # Set LedPin's mode is output
GPIO.outputLedPin GPIO.HIGH # Set LedPin highV to turn off led
GPIsetupLedPin GPIO.OUT # Set LedPin's mode is output
GPIO.outputLedPin GPIO.HIGH # Set LedPin highV to turn off led
# Set ButtonPin's mode as input with the internal pullup
GPIO.setupButtonPin
GPIO.IN pulzupdown GPIO.PUDUP
While True:
GPIO. input
else:
print led off'
GPIO.outputLedPin GPIO.HIGH# led off
GPIO.outputLedPin GPIO.LOW # led on
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
