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;我嘗試了所有的力量,例如移動它,並將其改變爲布爾值,但我無法使其發揮作用。
謝謝!這工作,下次我寫一個草圖時,我會記住這一點。 – joeybab3