Raspberry Pi Advanced Guide (wiringPi Tutorial, C Programming, GPIO Buttons, POSIX Multi-Threading)

preview_player
Показать описание
*****************************************
Update, March 2024:

WiringPi has been updated to support the latest Raspberry Pi 4/5, but it is not included with default Raspberry Pi OS image. You can use the following commands in your Raspberry Pi Terminal to get WiringPi installed:

cd wiringPiBasics

The above will give you access to the 'gpio' command and you will be able to compile C programs that use wiringPi library, for example:

gcc -Wall blink.c -lwiringPi -o blink
*****************************************

This 2-part Raspberry Pi GPIO tutorial shows how to correctly use buttons with wiringPi (C Programming). While I use the buttons to control LEDs, you can use the same approach with any other electronic components (or code in a subroutine/function in general).

If you are using Raspberry Pi 4 you may receive an error when attempting to use the gpio command. Follow this guide to fix it:

Part 1 video gives a general overview of wiringPi as of today, explains the concept of pull-up and pull-down resistors and demonstrates the circuit used in this tutorial.

Part 2 video covers the C coding part of this project, including:
- GPIO port initialization and safe deactivation
- Asynchronous button handlers using wiringPi interrupts
- Button de-bouncing using time and sampling methods
- Button callbacks using POSIX multi-threading

0:00 Intro
1:00 wiringPi Status
3:01 Pull-up and Pull-down Resistors
3:53 The Circuit

(Note: code posted may contain small updates and/or bug fixes not shown in the video)

Disclaimer:
"Raspberry Pi" and the distinct logo are a trademark of the Raspberry Pi Foundation.

Рекомендации по теме
Комментарии
Автор

High mr Heidenreich, do you plan to make this tutorial in Python in the near future?

jorisdenengenieur
visit shbcf.ru