#include <wiringPi.h>
#include <stdio.h>
#define ledPin 0
main()
{
wiringPiSetup()
int x;
for(x=0; x<4; x+1)
{
digitalWrite(ledPin, HIGH);
delay(500);
digitalWrite(ledPin, LOW);
delay(500);
}
}
错误在第7行,我已经坚持了2天了(我用geany编码(
-
听起来你在第8行遇到了一个编译错误:
wiringPiSetup() /* <-- You need to end the line with ";" */
-
你的循环应该是这样的:
for(x=0; x<4; x++) {...} /* "x+1" doesn't change the value of "x", so the loop will never terminate */
问题出在for循环中。
for(x=0; x<4; x+1)
括号中的第三个参数没有任何作用。您可能想要递增x
,您将使用x++
或x+=1
来执行此操作。
x+1
将返回该值,但该值不会存储在任何位置。