wiringPi Raspberry Pi 4

Beitrag vom 14.4.2020

Die aktuelle Raspbian-Version

Externer Link https://www.raspberrypi.org/downloads/raspbian/

Raspbian Buster with desktop and recommended software
Image with desktop and recommended software based on Debian Buster
Version: February 2020
Release date: 2020-02-13
Kernel version: 4.19
Size: 2530 MB

bringt wiringPi 2.5 mit und ist nicht mit Raspberry Pi 4 kompatibel!

Benötigt wird die neueste Version wiringPi 2.52:

Externer Link http://wiringpi.com/wiringpi-updated-to-2-52-for-the-raspberry-pi-4b/

Anleitung für die Installation von Gordon (Autor):

Just a quick post to let you know that you'll need a new wiringPi for the Raspberry Pi 4B.

To upgrade:

cd /tmp
wget  https://project-downloads.drogon.net/wiringpi-latest.deb
sudo dpkg -i wiringpi-latest.deb

Check with:

gpio -v

and make sure it's version 2.52. I'll push the updated sources shortly.

It will hopefully be part of the official release soon, but for now this will do.

-Gordon

Nun sollte auch dies wieder funktionieren:

 Interner Link Interner Link: GPIO programmieren: Konsole

Ja, nun wird der Prozessor erkannt und man kann z.B. mit Hilfe der Konsole eine LED an Pin 18 / GPIO24 steuern:

pi@raspberrypi:/tmp $ gpio export 24 out
pi@raspberrypi:/tmp $ gpio -v
#gpio version: 2.52
Copyright (c) 2012-2018 Gordon Henderson
This is free software with ABSOLUTELY NO WARRANTY.
For details type: gpio -warranty

Raspberry Pi Details:
Type: Pi 4B, Revision: 02, Memory: 4096MB, Maker: Sony
* Device tree is enabled.
*--> Raspberry Pi 4 Model B Rev 1.2
* This Raspberry Pi supports user-level GPIO access.
pi@raspberrypi:/tmp $ gpio -g write 24 1
pi@raspberrypi:/tmp $ gpio -g write 24 0

Das folgende C-Programm läuft in CodeBlocks problemlos.

Achtuing: In Codeblocks muss der Verweis auf die zu linkende Bibliothek gesetzt werden:

Settings - Compiler - Linker settings - Other linker options : -lwiringPi (eintragen)

Hinweis: Bei # include wiringpi.h fehlt links und rechts die Klammer (kleiner bzw. größer als):

 

#include wiringpi.h

int main()

{

   wiringPiSetup() ;

    pinMode (5, OUTPUT) ;

    for (;;)

    {

        digitalWrite (5, HIGH) ; delay (500) ;

        digitalWrite (5,  LOW) ; delay (500) ;

    }

}

Hier ein komplettes C++-Programm mit GUI (CodeBlocks + WxWidgets) zum Download:

Zip-Ordner Download CodeBlocks-Projekt

Siehe auch:

 Interner Link Interner Link: GUI mit Code::Blocks und WXSmith

.