not declared in this scope

so i am trying to do this project from the starter book

but it keeps saying

blueLEDPin was not declared in this scope

here is the code:

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;

int redSensorValue = 0;
int greenSensorValue = 0;
int blueSensorValue = 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);
}

there error message :

sketch_may23b.ino: In function 'void setup()':
sketch_may23b:21: error: 'blueLEDPin' was not declared in this scope
sketch_may23b.ino: In function 'void loop()':
sketch_may23b:29: error: expected ;' before 'blueSensorValue' sketch_may23b:32: error: expected ;' before 'Serial'
sketch_may23b:51: error: 'blueLEDPin' was not declared in this scope

blueLEDPin was not declared in this scope

const int blueLedPin = 10;

Look carefully

dehsar:
sketch_may23b:21: error: 'blueLEDPin' was not declared in this scope

Yes, you declared:

const int blueLedPin = 10;

Check uppercase/lowercase spelling!

With C/C++ the spelling is important, including uppercase/lowercase characters!

thanks alot guys amazing how you can spot these small things in a short amount of time w

dehsar:
thanks alot guys amazing how you can spot these small things in a short amount of time w

Not really - the compiler gave us a massive clue.

i got the same problem too, "not declared in this scope". but its more complex code i think, here the code

const int MaxMotors = 4;
int pingPin = 2;
int potPin = 1;
int MotorPins[MaxMotors] = {3,5,6,9};
int val = 0;
double MinVibe = 75;
double MaxVibe = 255;

void setup()
{
Serial.begin(9600);

}
void loop()
{

double duration;
double inches;
double cm;

inches = microsecondsToInches(duration);
cm = microsecondsToCentimeters(duration);

val = analogRead(potPin);
if(val>500){

pinMode(pingPin, OUTPUT);

digitalWrite(pingPin, LOW);
delayMicroseconds(2);

digitalWrite(pingPin, HIGH);
delayMicroseconds(5);

digitalWrite(pingPin, LOW);
pinMode(pingPin, INPUT);

duration = pulseIn(pingPin, HIGH);

double MaxDistance = 48;

double scale = 1 - inches / MaxDistance;

double Vibe = scaleMaxVibe;
if (Vibe <MinVibe) {
Vibe = MinVibe;}
for(int i=0;i <MaxMotors; i++) {
if (inches < MaxDistance) {
pinMode(MotorPins
, OUTPUT);*
_ analogWrite(MotorPins*,Vibe); }_
_
else{_
_ pinMode(MotorPins, OUTPUT);
analogWrite(MotorPins,0); } }*_

* Serial.print(scale);*
* //Serial.print("in, ");*
* delay(100);*
* Serial.println();*
* }*
* else {*
* pinMode(pingPin, LOW);*
* for(int n=0; n <MaxMotors; n++)*
* pinMode(MotorPins[n],LOW);}*
* long microsecondsToInches(long microseconds) {*
* return microseconds /74/2;}*
* long microsecondsToCentimeters(long microseconds) {*
* return microseconds / 29 / 2;*

* }*

}
-----------------------

when i try to compile, there was a message like this "'microsecondsToInches' was not declared in this scope" but when i remove the line of code "
* inches = microsecondsToInches(duration);*
* cm = microsecondsToCentimeters(duration);*
* long microsecondsToInches(long microseconds) {*
* return microseconds /74/2;}*
* long microsecondsToCentimeters(long microseconds) {*
* return microseconds / 29 / 2; *
"
the code was working fine, but because i use parrallax ping, it must use the microseconds bla bla bla lines, anyone can help me?, please, thank you. sorry for long post.

...and did you read the solutions in the thread you hijacked? Also did you read the post at the top, "how to use this forum"?

I have same problem: but it says:exit status 1
'greenLEDPin' was not declared in this scope

const int greenLEDpin = 9;
const int redLEDpin = 10;
const int blueLEDpin = 11;

const int redSensorPin = A0;
const int greenSensorPin = A1;
const int blueSensorPin = A2;

int redValue =0;
int greenValue = 0;
int blueValue = 0;

int redSensorValue = 0;
int greenSensorValue = 0;
int blueSensorvValue = 0;

void setup() {
Serial.begin(9600);

pinMode(greenLEDPin, OUTPUT);
pinMode(redLEDPin, OUTPUT);
pinMode(blueLEDPin, OUTPUT);
}
void loop() {
redSensorValue = analogRead(redSensorPin);
delay(5);
greenSensorValue = analogRead(greenSensorePin);
delay(5);
blueSebsorValue = analogRead(greenSensirePin);
Serial.print("Raw Sensor Values \t red: ");
Serial.print(redSensorValue);
Serial.print("\t green: ");
Serial.print(greenSensorValue);
Serial.print("\t blue: ");
Serial.println (blueSensorValue);
redValue = redSensorValue/4;
greenValue = greenSensorValue/4;
blueValue = blueSensorValue/4;
Serial.print("Mapped Sensor Values \t red; ");
Serial.print(redValue);
Serial.print("\t green: ");
Serial.print(greenValue);
Serial.print("\t blue: ");
Serial.println(blueValue);
analogWrite(redLEDPin, redValue);
analogWrite(greenLEDPin, greenValue);
analogWrite(blueLEDPin, blueValue);
}

Why is it that new people come to this Forum and cannot read the first three posts? Nick went to all that trouble for a reason, guys. READ THE DAMN POSTS AND LEARN HOW TO USE THIS FORUM CORRECTLY! And, yes, I am yelling!