1

I have my sketch(simplified version) as shown:

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

however it shows the error shown and highlights this line. int auto = 0; I have tried everything in my power, such as moving it, and changing it to a Boolean, but i can't get it to work.

4

1 に答える 1

1

「auto」は、変数にその初期化子のデータ型が自動的に与えられることを意味するキーワードです。予約されていない作品に置き換えると、コンパイルされます。

この IDE は、それを構文化しません。np++ などが行う場所。

于 2013-11-05T03:03:10.230 に答える