vim test.c或者是nano test.c
进入后编写c程序。
gcc test.c -o test//生成test.exe
./test //运行test
#include <wiringPi.h>
int main (void)
{
wiringPiSetup () ; // 初始化 这个必须写在最前面
pinMode (0, OUTPUT) ; // 设置GPIO.0 为输出
for (;;) // 无限循环
{
digitalWrite (0, HIGH); // GPIO.0 输出高
delay (500); // 延时500毫秒
digitalWrite (0, LOW); // GPIO.0 输出低
delay (500);
}
return 0 ;
}
---------------------
.编译文件:gcc -Wall -o led led.c -lwiringPi
这里的意思是把led.c
文件编译输出led
文件