Code Errors but it matches the example?

Hi Guys,

This is the second time ive have had this issue, i am currently copying the code for Project 04 - colour mixing lamp, out of the starter book.

I am verifying the code as i work through it, i am getting errors that dont look to be incorrect, i have checked them against the book and the examples, copy and pasted the examples but still get these error messages ---

C:\Users\servi\AppData\Local\Temp.arduinoIDE-unsaved2024515-20368-1vu93pt.fsjhg\sketch_jun15a\sketch_jun15a.ino: In function 'void setup()':
C:\Users\servi\AppData\Local\Temp.arduinoIDE-unsaved2024515-20368-1vu93pt.fsjhg\sketch_jun15a\sketch_jun15a.ino:18:9: error: 'blueLEDPin' was not declared in this scope
pinMode(blueLEDPin, OUTPUT);
^~~~~~~~~~
C:\Users\servi\AppData\Local\Temp.arduinoIDE-unsaved2024515-20368-1vu93pt.fsjhg\sketch_jun15a\sketch_jun15a.ino:18:9: note: suggested alternative: 'blueLEWPin'
pinMode(blueLEDPin, OUTPUT);
^~~~~~~~~~
blueLEWPin
C:\Users\servi\AppData\Local\Temp.arduinoIDE-unsaved2024515-20368-1vu93pt.fsjhg\sketch_jun15a\sketch_jun15a.ino: In function 'void loop()':
C:\Users\servi\AppData\Local\Temp.arduinoIDE-unsaved2024515-20368-1vu93pt.fsjhg\sketch_jun15a\sketch_jun15a.ino:23:1: error: 'redSensorValue' was not declared in this scope
redSensorValue = analogRead(redSensorPin);
^~~~~~~~~~~~~~
C:\Users\servi\AppData\Local\Temp.arduinoIDE-unsaved2024515-20368-1vu93pt.fsjhg\sketch_jun15a\sketch_jun15a.ino:23:1: note: suggested alternative: 'redSensoreValue'
redSensorValue = analogRead(redSensorPin);
^~~~~~~~~~~~~~
redSensoreValue

exit status 1

Compilation error: 'blueLEDPin' was not declared in this scope

This is the CODE i have written below --

const int greenLEDPin = 9;
const int redLEDPin = 10;
const int blueLEWPin = 11;
const int redSensorPin = A0;
const int greenSensorPin = A1;
const int blueSensorPin = A2;
int redValue = 0;
int greenValue = 0;
int blueValue = 0;
int redSensoreValue = 0;
int greenSensorValue = 0;
int blueSensorValue = 0;
void setup() {
  // put your setup code here, to run once:
Serial.begin(9600);
pinMode(greenLEDPin, OUTPUT);
pinMode(redLEDPin, OUTPUT);
pinMode(blueLEDPin, OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
redSensorValue = analogRead(redSensorPin);
delay(5);
greenSensorValue = analogRead(greenSensorPin);
delay(5);
blueSensorValue = analogRead(blueSensorPin);
delay(5);
}

Thanks for the help, im a complete novice but keen to learn.

Welcome to the forum

In your sketch I see this

const int blueLEWPin = 11;

Later you do this

pinMode(blueLEDPin, OUTPUT);

But where is blueLEDPin declared ?

1 Like

Thanks I changed blueLEWPin to blueLEDPin and it worked.

Thanks for the help.

It might be time for some glasses!

The error message was very specific but a second pair of eyes is always helpful

I assume that you have fixed the other similar error too

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.