Categories

GPIO, Input & Output GUI panel using Tkinter

In this tutorial we will be Designing a Graphical panel through which we will be able to control all the 21 GPIO’s of Raspberry Pi as an Input or Output Pin.

Credits for the program – scotty3785, Original code link – click here

Step 1 – Programming the Raspberry Pi

  • Open the python IDLE in Raspberry Pi and create a new Python file and enter the following code.

  • Now save the program. We are saving it as gpio.py python file.

Step 2 – Running the program and Understanding the GUI panel

  • Now open terminal and type command sudo python gpio.py to run the program.
  • A panel window will open up like this –

  • From here you can set the status of any GPIO pin from the Corresponding drop down menu as Passive, Input or Output.
  • If you have selected Output, then you will have to mark or unmark the corresponding High/Low box to make the Pin Low or High
  • If you have selected Input, then the low Input will show the the Red colour and if input is high, it will show  Green Colour.

Now you can Explore the more of a GUI with Tkinter.

For more on tkinter you can visit – https://wiki.python.org/moin/TkInter

About the Author

abhishek@robu.in

Abhishek Thakur, Embedded Systems Enthusiast

Related Post

Submit a Review

Display Name

Email

Title

Message