![]() Once the circuit is completed, you can run the code using the “ Run” button on the Thonny IDE to see if the LED starts blinking. If you are using LED with an in-built resistor then you can skip the resistor.įollow the below-given circuit for a better picture. A resistor is connected to the positive terminal of the LED so that the LED won’t burn due to excessive voltage.The positive terminal of a LED is connected to GPIO 17 (pin 11 on board) and the negative terminal of the LED is connected to the Ground (pin 6 on board).To create the circuit for LED blinking, follow the guidelines given below: However, before that, you must create a circuit using the code you just created in the above steps. Now the coding part is completed, it’s now time to test the code. To start using the GPIO pins, you have to import the GPIO library using the following code.Īfter completing the code, save the file using the “ Save” button from the menu bar.Ĭhoose an appropriate name for your file. The Thonny Python interface will appear on the screen as shown below: ![]() To use the Python editor, go to the Application Menu, select the “ Programming” option to open the Thonny Python IDE on Raspberry Pi desktop. The steps to write a python code using the Thonny Python editor are mentioned below with an example: Raspberry PI OS comes with a pre-installed Python editor called Thonny Python IDE that allows users to code the GPIO pins in Python. How to Use Raspberry Pi GPIO Pins – Python Tutorial The pin labels are shown in the image below, and only those pins that start with the name GPIO are programmable:įor details about these pins’ headers, follow this. In Raspberry Pi 4, they are 40 GPIO pins, which are highlighted in the image below: GPIO or General-Purpose Input/Output Pins are the key component of the Raspberry Pi board since through these pins you can control any circuit right from your system. ![]() GPIO Pins on Raspberry Pi-Python Tutorial The official language for the Raspberry Pi operating system is Python so, in this tutorial, we will show you in detail how to use Raspberry Pi GPIO pins through Python. Just like any microcontroller, these GPIO pins can be used as output or input pins to control different circuits using Raspberry Pi. One of the amazing features of Raspberry Pi is its programmable pins known as GPIO Pins.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |