debian | ||
devLib | ||
examples | ||
gpio | ||
pins | ||
wiringPi | ||
wiringPiD | ||
.gitignore | ||
build | ||
COPYING.LESSER | ||
INSTALL | ||
newVersion | ||
People | ||
README.md | ||
update | ||
VERSION | ||
version.h |
说明
本仓库是将 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