From 8238f46ccf364503552115a0540e6159433b80f9 Mon Sep 17 00:00:00 2001 From: aixiao Date: Fri, 1 Dec 2023 18:08:53 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 94 +++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 71 insertions(+), 23 deletions(-) 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 + +```