![]() With the GPIOs, currents can not only be switched, but they can also be read out. ![]() This turns the LED on and off 5 times, waiting for half a second in between before changing the status. It’s pretty easy, isn’t it? If you want to build a small flashing circuit, you can e.g. This command simply says whether a voltage of 3.3V (HIGH) or 0V (LOW) should be applied. With the following two commands we can firstly switch the LED on and then switch it off again: GPIO.output(23, GPIO.HIGH) The output functions for this pin are now available. First of all, we have to define the pin as output: tup(23, GPIO.OUT) Now it goes back to the Python console, where we enter our code. The longer end comes to the positive 3.3 volt voltage of the GPIO 23 (pin 16). The LED has two ends of different lengths. The colours are irrelevant and are only intended for better differentiation. As a connection between the Raspberry Pi and the breadboard, you can use the jumper cables and simple wire for all other connections. We build the LEDs according to the following graphic. Since we want the latter, the command is: tmode(GPIO.BCM)įirst of all, we want to switch a few simple LEDs using the GPIOs. Then we indicate whether we want to address the GPIOs via board numbers (1-40) or via their GPIO number. We also import a library with which we can stop the script for a short time. This library already contained all the required functions, so we do not have to write any additional functions for it. We are importing a library with which we can program the Raspberry Pi GPIO pins. In the opened Python console we first enter the following: import RPi.GPIO as GPIO Most tutorials do not use the pin numbering, but the GPIO number.Īs before, we open the Python editor via the Start menu > Programming. Always pay attention to whether pin or GPIO is used. This is important because you can address a GPIO via both numbers. There is also “Ground” (= ground connection) and the voltage pins (3.3V and 5V).Īs you can see, there are two pin assignments: First the ascending pin assignment (starting at 1 in the top left) and then the rather random numbering of the GPIOs. Raspberry Pi GPIO Pin AssignmentĪll pins that have “GPIO” in their names can be programmed. The left (green) side should symbolize the board of the Raspberry Pi. The following graphic lists the complete pins including functions and numbering. Not all of them can be read out or connected as there are also some voltage and ground connections. Since model B +, the Raspberry Pi’s have a 40-pin header. an LED can be inserted in two columns next to each other. The connections on the middle pins are vertical. At the top and on the bottom, you can see two horizontal bars, to which you normally attach the plus and minus pole of a device. The lines show which of the holes are connected. The connections are marked in the schematic drawing below. There are breadboards in different sizes, but the structure is usually as follows: It offers great advantages especially when testing and designing. If you want to build more hardware projects, you will definitely need these accessories.Ī breadboard is helpful as by using it one is able to set up circuits quickly without having to solder them every time. Incidentally, these components are always needed. Male-female jumper cable for the connection between Raspberry Pi and the breadboard.Breadboard, the functionality of which is explained below.In this tutorial, we will need a few hardware building blocks. I will try to incorporate that in the future. For those who already have programming experience but have not yet worked with the GPIOs, you can start with this directly.īy the way: It would be great for the other parts if you have any suggestions or what interests you the most. If you have not read the first part and you still have problems with the basics, I would advise you to go through that one first. In addition, I will also explain how a breadboard works. For this we will write a Python program, on the one hand, we record inputs and on the other hand, we switch the Raspberry Pi GPIO pins so that we can switch other modules and sensors. These so-called GPIOs can easily be switched via a program, which we will go through in this tutorial. One of the special features of the Raspberry Pi is the programmable input-output pins.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |