"error: expected unqualified-id before numeric constant"

Konnte ich nicht finden, eine Lösung für diesen Fehler, der schien zu passen
Ich bin sehr neu in arduino und versuche, eine Reihe von 5 LEDs Leuchten, wie die potentiometer

Ich bin der Bearbeitung der ifstatementconditional Beispiel-Skizze, um dies zu erreichen, aber halten immer diese Fehlermeldung

hier ist der code

//These constants won't change:
const int analogPin = A1;   
const int ledPins[5] = {
  13, 12, 11, 10, 9 };
const int threshold = 1023;   
const int section = threshold / 5; 
const int pinCount = 5

void setup() {
  for (int thisPin = 0; thisPin < pinCount; thisPin++)  {
    pinMode(ledPins[thisPin], OUTPUT);      
  }
  //initialize serial communications:
  Serial.begin(9600);
}

void loop() {
//read the value of the potentiometer:
int analogValue = analogRead(analogPin);

//if the analog value is high enough, turn on the LED:
if (analogValue > section * 1) {
  digitalWrite(ledPins[0], HIGH);
} 
else{
  digitalWrite(ledPins[0], LOW);
}

if (analogValue > section * 2) {
  digitalWrite(ledPins[1], HIGH);
} 
else{
  digitalWrite(ledPins[1], LOW);
}

if (analogValue > section * 3) {
  digitalWrite(ledPins[2], HIGH);
} 
else{
  digitalWrite(ledPins[2], LOW);
}

if (analogValue > section * 4) {
  digitalWrite(ledPins[3], HIGH);
} 
else{
  digitalWrite(ledPins[3], LOW);
}

if (analogValue > section * 5) {
  digitalWrite(ledPins[4], HIGH);
} 
else{
  digitalWrite(ledPins[4], LOW);
}



//print the analog value:
Serial.println(analogValue);
delay(1);        //delay in between reads for stability
}
  • Die Fehlermeldung enthält wahrscheinlich eine Zeilennummer
InformationsquelleAutor SamHansard | 2014-03-22
Schreibe einen Kommentar