Go to file
2023-12-01 18:08:53 +08:00
debian first commit 2023-08-11 15:53:17 +08:00
devLib first commit 2023-08-11 15:53:17 +08:00
examples first commit 2023-08-11 15:53:17 +08:00
gpio 增加设备蓝莓(Blueberry) 2023-12-01 17:50:18 +08:00
pins first commit 2023-08-11 15:53:17 +08:00
wiringPi 增加设备蓝莓(Blueberry) 2023-12-01 17:50:18 +08:00
wiringPiD first commit 2023-08-11 15:53:17 +08:00
.gitignore first commit 2023-08-11 15:53:17 +08:00
build 增加设备蓝莓(Blueberry) 2023-12-01 17:50:18 +08:00
COPYING.LESSER first commit 2023-08-11 15:53:17 +08:00
INSTALL first commit 2023-08-11 15:53:17 +08:00
newVersion first commit 2023-08-11 15:53:17 +08:00
People first commit 2023-08-11 15:53:17 +08:00
README.md 修改文档 2023-12-01 18:08:53 +08:00
update first commit 2023-08-11 15:53:17 +08:00
VERSION first commit 2023-08-11 15:53:17 +08:00
version.h first commit 2023-08-11 15:53:17 +08:00

说明

本仓库是将 wiringOP 移植到 Blueberry 上。

下载

apt-get update  
apt-get install -y git  
git clone https://git.aixiao.me/aixiao/wiringPi_Blueberry.git  

编译安装

cd wiringPi_Blueberry
bash build clean
bash build 

测试

#include <wiringPi.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>

int main(int argc, char *argv[])
{
    char* usage = "LED flashing\nUsage: %s [wPi]\r\n";
    int pin_number = 0;
    
    if (argc != 2) {
        printf(usage, argv[0]);
        exit(0);
    } else {
        if (isdigit(*argv[1])) {
            pin_number = atoi(argv[1]);
            // do something with pin_number
            printf("Pin number is %d\n", pin_number);
        } else {
            printf("Invalid input for pin number: %s\n", argv[1]);
            exit(1);
        }
    }
    

    wiringPiSetup();
    pinMode(pin_number, OUTPUT);
    
    while (1)
    {
        digitalWrite(pin_number, HIGH);
        delay(1000);
        digitalWrite(pin_number, LOW);
        delay(1000);
    }
    
    return 0;
}


gcc -Wall -g -Os led_flashing.c -lwiringPi -lpthread
./a.out 3