diff --git a/README.md b/README.md index fe95c83..a5550bb 100644 --- a/README.md +++ b/README.md @@ -1,23 +1,71 @@ -# 说明 - -本仓库是将 wiringOP 移植到 [Blueberry](https://git.aixiao.me/aixiao/Blueberry) 上。 - - - -## 下载 - -```bash -apt-get update -apt-get install -y git -git clone https://git.aixiao.me/aixiao/wiringPi_Blueberry.git -``` - - - -## 编译安装 - -```bash -cd wiringPi_Blueberry -bash build clean -bash build -``` +# 说明 + +本仓库是将 wiringOP 移植到 [Blueberry](https://git.aixiao.me/aixiao/Blueberry) 上。 + + + +## 下载 + +```bash +apt-get update +apt-get install -y git +git clone https://git.aixiao.me/aixiao/wiringPi_Blueberry.git +``` + + + +## 编译安装 + +```bash +cd wiringPi_Blueberry +bash build clean +bash build +``` + +## 测试 +```c +#include +#include +#include +#include +#include + +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 + +```