2013-11-05 33 views
1

我有我的素描(簡化版),如「錯誤之前‘=’令牌預期不合格-ID」:的Arduino:

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);      
} 

但它顯示出了錯誤,並強調此行。 int auto = 0;我嘗試了所有的力量,例如移動它,並將其改變爲布爾值,但我無法使其發揮作用。

回答

1

「auto」是一個關鍵字的含義,即一個變量會自動給出其初始化程序的數據類型。用非保留的工作替換它,它會編譯。

此IDE不會對其進行語法分析。其中np ++和其他人在做什麼。

+0

謝謝!這工作,下次我寫一個草圖時,我會記住這一點。 – joeybab3