Ciao a tutti
Sto svolgendo il progetto 4 dello starter kit (la lampada miscela colori). Ho scritto/copiato il codice pari pari dal libro, ma continua a darmi un messaggio di errore. Questo è il codice
const int greenLEDPin = 9;
const int redLEDPin = 11;
const int blueLEDPin = 10;
const int redSensorPin = A0;
const int greenSensorPin = A1;
const int blueSensorPin = A2;
int redValue = 0;
int greenValue = 0;
int blueValue = 0;
void setup() {
Serial.begin(9600);
pinMode(greenLEDpin, OUTPUT);
pinMode(redLEDpin, OUTPUT);
pinMode(blueLEDpin, OUTPUT);
}
void loop() {
redSensorValue = analogRead(redSensorPin);
delay(5);
greenSensorValue = analogRead(greenSensorPin);
delay(5);
blueSensorValue = analogRead(blueSensorPin);
Serial.print("Raw Sensor Values \t Red: ");
Serial.print(redSensorValue);
Serial.print("\t Green: ");
Serial.print(greenSensorValue);
Serial.print("\t Blue: ");
Serial.print(blueSensorValue);
redValue = redSensorValue/4;
greenValue = greenSensorValue/4;
blueValue = blueSensorValue/4;
Serial.print("Mapped Sensor Value \t Red: ");
Serial.print(redValue);
Serial.print("\t Green: ");
Serial.print(greenValue);
Serial.print("\t Blue: ");
Serial.print(blueValue);
analogWrite(redLEDPin, redValue);
analogWrite(greenLEDPin, greenValue);
analogWrite(blueLEDPin, blueValue);
}
Continuo a ricevere questo messaggio di errore:
Arduino:1.7.8 (Mac OS X), Scheda:"Arduino Uno"
sketch_dec20a.ino: In function 'void setup()':
sketch_dec20a.ino:16:11: error: 'greenLEDpin' was not declared in this scope
sketch_dec20a.ino:17:11: error: 'redLEDpin' was not declared in this scope
sketch_dec20a.ino:18:11: error: 'blueLEDpin' was not declared in this scope
sketch_dec20a.ino: In function 'void loop()':
sketch_dec20a.ino:22:3: error: 'redSensorValue' was not declared in this scope
sketch_dec20a.ino:24:3: error: 'greenSensorValue' was not declared in this scope
sketch_dec20a.ino:26:3: error: 'blueSensorValue' was not declared in this scope
Errore durante la compilazione
Questo report potrebbe essere più ricco
di informazioni con
"Mostra un output dettagliato durante la compilazione"
abilitato in "File > Impostazioni"