Тёмный

Python GPIO - Input Pin Push Button Example & Compatibility With Raspberry Pi 5 

Phazer Tech
Подписаться 7 тыс.
Просмотров 954
50% 1

Опубликовано:

 

27 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 8   
@PhazerTech
@PhazerTech 2 месяца назад
I didn't notice the "libraries" typo until after I uploaded the video. I fixed the thumbnail but can't fix it in the video. 🙃 Update: If using the official Raspberry Pi OS then you'll need to install the lgpio library as a system package, not with PIP. I've updated the written guide to include this. Also something important I forgot to mention is the concept of a "pull up resistor" and a "pull down resistor". In this push button example R4 is acting as a "pull down resistor", meaning it pulls the input down low to ground to guarantee that the pin reads low if the button isn't being pressed. Then when the button is pressed, the voltage divider creates roughly 3 volts on the pin which pulls up the input pin so that it registers as high. Alternatively, we could have tied the input pin to 3.3V with a "pull up resistor", then wire the button so that it forces the pin down to ground when it's pressed. Then in the code, we would check to see if the pin is low to turn on the LED, instead of checking if the pin is high. This method is the exact opposite of what was done in the video, and both are valid ways to achieve the same results. It's a similar concept as NPN vs PNP transistors which I explained in my Electronics 101 video on transistors. The input pins also have internal pull up and pull down resistors that can be activated in software, which means R4 isn't necessary. But it's usually better to hard wire your own pull up/down resistor instead of relying on the internal one because it's easy to make a mistake in the code and you might forget. Hopefully this makes sense, feel free to ask any questions.
@anujpai
@anujpai 16 дней назад
i am using raspberry pi 5 64 bit os and still not able to acces the gpio bin. even not able to detect a push button
@PhazerTech
@PhazerTech 16 дней назад
Which library are you using? If using the official RPi OS then trying installing lgpio with this command: sudo apt install python3-rpi-lgpio I've updated the guide to show this.
@tarunjeetsingh1111
@tarunjeetsingh1111 23 дня назад
i am getting a error " RuntimeError: Cannot determine SOC peripheral base address" what should I do? please help me
@PhazerTech
@PhazerTech 23 дня назад
Which Pi model? Which OS? Which GPIO library did you install?
@hollywoodbuster2740
@hollywoodbuster2740 17 дней назад
Me to same error I face
@hollywoodbuster2740
@hollywoodbuster2740 17 дней назад
Can you recomanded os and libery​@@PhazerTech
@PhazerTech
@PhazerTech 16 дней назад
If using the official RPi OS you'll need to install lgpio as a system package, not PIP. I've updated the written guide to show this.
Далее
Every Developer Needs a Raspberry Pi
27:27
Просмотров 605 тыс.
11 ming dollarlik uzum
00:43
Просмотров 279 тыс.
You’ve Never Seen WiFi Like This
20:43
Просмотров 904 тыс.
Raspberry Pi Pico and Arduino Uno chat via I2C
26:14
Просмотров 10 тыс.
UART | Raspberry Pi Pico Workshop: Chapter 4.2
11:57
Просмотров 3,6 тыс.