修改文档

This commit is contained in:
aixiao 2023-12-01 18:08:53 +08:00
parent 73afdd8e62
commit 8238f46ccf

View File

@ -21,3 +21,51 @@ cd wiringPi_Blueberry
bash build clean
bash build
```
## 测试
```c
#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
```