Raspberry Pi 4B update method wiringPi library to 2.52

Raspberry Pi 4B update method wiringPi library to 2.52

The latest release of raspberry pie 4B in burning buster after the official system, if used directly gpio readall to view the GPIO an error. Not recognize the situation, you need to be updated wiringPi according to the following steps.

  • After landing to open a terminal and type:
cd /tmp
wget https://project-downloads.drogon.net/wiringpi-latest.deb
sudo dpkg -i wiringpi-latest.deb

Style terminal
Then use

gpio -v

Check the version information to ensure version: 2.52 can be.
Check the version
View IO

gpio readall

IO pin View
This time we can continue to use as GPIO pins as usual be programmed.
We just write a program verification, the pin 4B, first look at the Raspberry Pi.
Raspberry Pi Pin map
Code:

#include <stdio.h>
#include <wiringPi.h>
int main(void)
{
    int LED = 1;
    wiringPiSetup();
    pinMode(LED,OUTPUT);
    printf("LED is running...\n");
    for (;;)
    {
        printf("LED:%d is on\n",LED);
        digitalWrite(LED,HIGH);
        delay(500);

        printf("LED:%d is off\n",LED);
        digitalWrite(LED,LOW);
        delay(500);

    }
    return 0;
}

Compiled code

gcc -o led -lwiringPi led.c

Operating results is led flashes.

Published 15 original articles · won praise 9 · views 2653

Guess you like

Origin blog.csdn.net/qq_38413498/article/details/103196203