Answered step by step
Verified Expert Solution
Question
1 Approved Answer
How to we write the background, explain code and wiring of lab reading a pushbutton # ! / usr / bin / env python import
How to we write the background, explain code and wiring of lab reading a pushbutton #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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started