1

我有我的草图(简化版),如图所示:

int sensorPin = 0;    // select the input pin for the photocell
int ledPin = 11;      // select the pin for the LED
int sensorValue = 0;  // variable to store the value coming from the sensor
int auto = 0;
void setup() {
// declare the ledPin as an OUTPUT:
pinMode(ledPin, OUTPUT);  
Serial.begin(9600);   
}
void loop() {
// read the value from the sensor:
sensorValue = analogRead(sensorPin);    
Serial.print("Digital reading = ");
Serial.println(sensorValue);     // the raw analog reading
// turn the ledPin on
if (auto > 1)
if (sensorValue < 700){
digitalWrite(ledPin, LOW);
}else{
digitalWrite(ledPin,HIGH);
}  
// stop the program for <sensorValue> milliseconds:
delay(10);                    
}

但是它显示了显示的错误并突出显示了这一行。诠释自动 = 0; 我已经尽我所能尝试了一切,例如移动它,并将其更改为布尔值,但我无法让它工作。

4

1 回答 1

1

“auto”是一个关键字,意思是变量自动被赋予其初始化程序的数据类型。将其替换为非保留作品,它将编译。

此 IDE 不对其进行语法处理。np++ 和其他人在哪里。

于 2013-11-05T03:03:10.230 回答