In this project, we have used Python GUI along with Raspberry Pi to control an LED. Pin number 8 on the Raspberry Pi has been configured as the output. The code for running this program consists of 2 functions β ON and OFF and 2 Buttons which are used to call these aforementioned functions.
Programming Algorithm:
Step 1:
Import all the necessary packages - tkinter, Rpi.GPIO, time. The package time has been imported in case the function time.sleep is required. However, it has not been used and therefore can be omitted.
Step 2:
Create a window using Tk() and specify its geometry and title.
Step 3:
Set up the GPIO pins and configure Pin number 8 as Output
Step 4:
Define 2 functions to turn the LED on and off
Step 5:
Create 2 buttons in the window and give them the previously mentioned functions as command.
Step 6:
Put the window in a loop.
Video:
Comments