新人,最近刚学的Arduino,之前看过谭浩强的C语言(手动斜眼)
今天想联系一下,然后就编了一个程序,结果.......
程序是
const int LED 9
int i = 0;
void setup()
{
pinMode(LED, OUTPUT);
}
void loop()
{
for(i=0; i<255; i++)
{
analogWrite(LED, i);
delay(10);
}
for(i = 255; i > 0; i--)
{
analogWrite(LED, i);
delay(10);
}
}
报错是
sketch_jun04a:1: error: expected initializer before numeric constant
sketch_jun04a.ino: In function 'void setup()':
sketch_jun04a:6: error: 'LED' was not declared in this scope
sketch_jun04a.ino: In function 'void loop()':
sketch_jun04a:11: error: 'i' was not declared in this scope
sketch_jun04a:13: error: 'LED' was not declared in this scope
sketch_jun04a:19: error: 'LED' was not declared in this scope
今天想联系一下,然后就编了一个程序,结果.......
程序是
const int LED 9
int i = 0;
void setup()
{
pinMode(LED, OUTPUT);
}
void loop()
{
for(i=0; i<255; i++)
{
analogWrite(LED, i);
delay(10);
}
for(i = 255; i > 0; i--)
{
analogWrite(LED, i);
delay(10);
}
}
报错是
sketch_jun04a:1: error: expected initializer before numeric constant
sketch_jun04a.ino: In function 'void setup()':
sketch_jun04a:6: error: 'LED' was not declared in this scope
sketch_jun04a.ino: In function 'void loop()':
sketch_jun04a:11: error: 'i' was not declared in this scope
sketch_jun04a:13: error: 'LED' was not declared in this scope
sketch_jun04a:19: error: 'LED' was not declared in this scope