Hello I have a small problem, there is an error message !

Hello I have a small problem, there is an error message and I dont know how I can fixt that.
The message is :

Lampe_d_ambiance:54:19: error: 'blueValue' was not declared in this scope

How I can declared that ?

My code is :

void setup() {
  // put your setup code here, to run once:
  
   
  const int greeLEDPin = 9;
  const int redLEDPin = 11;
  const int  blueLEDPin = 10;

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


  int redSensorValue = 0;
  int greenSensorValue = 0;
  int blueSensorValue = 0; 

   Serial.begin(9600);


  pinMode(greenLEDin,OUTPUT);
  pinMode(redLEDin,OUTPUT);
  pinMode(blueLEDin,OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
  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.println(blueSensorValue); 


   redValue = redSensorValue/4
   greenValue = greenSensorValue/4
   blueValue = blueSensorValue/4

   Serial.print("Valeurs recalculees \t Rouge : ");
   Serial.print(redValue);
   Serial.print("\t Vert : ");
   Serial.print(greenValue);
   Serial.print("\t Blue : ");
   Serial.println(blueValue);
   
   analogWrite(redLEDPin, redValue);
   analogWrite(greenLEDPin, greenValue); 
   analogWrite(blueLEDPin, blueValue);
   }

Thanks !

‘blueValue’ needs to be defined.

Look up what ‘local’ and ‘global’ variables are.

https://www.arduino.cc/reference/en/language/variables/variable-scope--qualifiers/scope/

You have plenty errors

Number of missing semi-colons
2)
greeLEDPin is not the same as greenLEDin
3)
All your pins and variables are declared within setup() and therefore are not known in loop() (which results in errors). You will have to move them outside setup(); the sensor variables can go inside loop().
4)
You use variables that are not declared.

Thank you all, I tried to apply your advice in my code:
I tried to declare my variables outside Setup and Loop for which side effect everywhere but it doesn't seem to work...
I also added semicolons where they were missing.

Here is the new version of my code:

const int greeLEDPin = 9;
  const int redLEDPin = 11;
  const int  blueLEDPin = 10;

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


  int redSensorValue = 0;
  int greenSensorValue = 0;
  int blueSensorValue = 0; 


void setup() {
  // put your setup code here, to run once:
  
  

   Serial.begin(9600);


  pinMode(greenLEDin,OUTPUT);
  pinMode(redLEDin,OUTPUT);
  pinMode(blueLEDin,OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:

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

  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.println(blueSensorValue); 


   redValue = redSensorValue/4;
   greenValue = greenSensorValue/4;
   blueValue = blueSensorValue/4:

   Serial.print("Valeurs recalculees \t Rouge : ");
   Serial.print(redValue);
   Serial.print("\t Vert : ");
   Serial.print(greenValue);
   Serial.print("\t Blue : ");
   Serial.println(blueValue);
   
   analogWrite(redLEDPin, redValue);
   analogWrite(greenLEDPin, greenValue); 
   analogWrite(blueLEDPin, blueValue);
   }

And this time here are the error messages in their entirety:

Arduino : 1.8.6 (Windows 10), Carte : "Arduino/Genuino Uno"

C:\Users\Utilisateur\Documents\Arduino\temperature\Lampe_d_ambiance\Lampe_d_ambiance.ino: In function 'void setup()':

Lampe_d_ambiance:27:11: error: 'greenLEDin' was not declared in this scope

   pinMode(greenLEDin,OUTPUT);

           ^

Lampe_d_ambiance:28:11: error: 'redLEDin' was not declared in this scope

   pinMode(redLEDin,OUTPUT);

           ^

Lampe_d_ambiance:29:11: error: 'blueLEDin' was not declared in this scope

   pinMode(blueLEDin,OUTPUT);

           ^

C:\Users\Utilisateur\Documents\Arduino\temperature\Lampe_d_ambiance\Lampe_d_ambiance.ino: In function 'void loop()':

Lampe_d_ambiance:55:33: error: expected ';' before ':' token

    blueValue = blueSensorValue/4:

                                 ^

Lampe_d_ambiance:65:16: error: 'greenLEDPin' was not declared in this scope

    analogWrite(greenLEDPin, greenValue); 

                ^

exit status 1
'greenLEDin' was not declared in this scope

How can I correct them?

Thanks!

Look at the first line of your new new code; what did you call the variable? Which name did you use elsewhere?

Check your spelling e.g. greenLEDPin, greeLEDPin and greenLEDin are all different names. And you can't use : when you mean ;.

Those error messages are really quite clear.

Steve

greeLEDPin != greenLEDin :confused:

Thank you all!

There are no more error messages! And I'm sorry if I asked questions that seemed very simple to you, I'm a beginner and I have very little knowledge of arduino programming.

Thank you again! :wink:

Jules3000:
There are no more error messages! And I'm sorry if I asked questions that seemed very simple to you, I'm a beginner and I have very little knowledge of arduino programming.

Now you have learned what "was not declared in this scope" means.
One style hint that might help: Start your global variable names with a capital letter. Then when you get a "not declared" error you will see if the variable was supposed to be declared inside the function (local) or outside all functions (global).