Question: Write a Python program that controls an LED and makes it blinks such that it turns ON for three seconds and turns OFF for
Write a Python program that controls an LED and makes it blinks such that it turns ON for three seconds and turns OFF for one second. Task 2: Add a switch to control the LED, i.e., your Python program should read the switch status and turn on or off the LED blinking from Task 1 accordingly. In addition to time and loop functionality (also needed in Task 1), make sure to also use callbacks when switch activity is detected. Task 3: Add a second switch that controls the blinking rate, i.e., it toggles between a fast (1 second) and slow (3 seconds) blinking rate. Also use a callback function to handle switch activity.
Step by Step Solution
There are 3 Steps involved in it
Task 1 LED Blinking CODE import time import RPiGPIO as GPIO GPIOsetmodeGPIOBOARD Use physical pin numbering LEDPIN 18 Connect LED to pin 18 GPIOsetupL... View full answer
Get step-by-step solutions from verified subject matter experts
