What Is wrong with this 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 Values \t Red: ") Serial.print(redValue); Serial.print("\t Green: "); Serial.print(greenValue); Serial.print("\t Blue: "); Serial.print(bluevalue); analogWrite(redLEDin, redValue); analogWrite(greenLEDin, greenValue); analogWrite(blueLEDin, blueValue); }

/tmp/000075186/Project_4/Project_4.ino: In function 'void loop()':

/tmp/000075186/Project_4/Project_4.ino:36:3: error: expected ';' before 'Serial'

Serial.print(redValue);

^

/tmp/000075186/Project_4/Project_4.ino:40:16: error: 'bluevalue' was not declared in this scope

Serial.print(bluevalue);

^

/tmp/000075186/Project_4/Project_4.ino:41:15: error: 'redLEDin' was not declared in this scope

analogWrite(redLEDin, redValue);

^

/tmp/000075186/Project_4/Project_4.ino:42:15: error: 'greenLEDin' was not declared in this scope

analogWrite(greenLEDin, greenValue);

^

/tmp/000075186/Project_4/Project_4.ino:43:15: error: 'blueLEDin' was not declared in this scope

analogWrite(blueLEDin, blueValue);

^

exit status 1

(deleted)

(deleted)

Those errors were about as clear as it's possible to get.

C++ is case sensitive. bluepin and bluePin are not the same.

Can you find anywhere where blueLEDin is defined? I can see a blueLEDpin but not that.

Statements need ; on the end. Like the one that's missing just before the Serial.print error.

Steve

Thank you all so Much. This my first year learning basic coding and I am just now understanding each small detail is so very important. Im not lazy and I did look over this repeatedly and retyped most of it. I genuinely appriciate the time you spent.

Yep, that's the 'c++' and 'c' language. You have to know what you want and you have to tell the compiler what it should do.

530pools: Thank you all so Much. This my first year learning basic coding and I am just now understanding each small detail is so very important. Im not lazy and I did look over this repeatedly and retyped most of it. I genuinely appriciate the time you spent.

Missing semicolons is a very common error, especially for beginners. Until one trains oneself to look for them one can spend an inordinate amount of time trying to figure out why the compiler choked on a bit of code after the missing semicolon. Especially when one "sees" a semicolon where one should be but isn't because the mind is playing tricks on you.

Good luck on your journey learning to code.

Moreover, you do not need to write “redPinSensor = A0” and then analogRead(redPinSensor). Just write “redPinSensor = 0” because analogRead can only* read analog Pins.

AKJ: Moreover, you do not need to write "redPinSensor = A0" and then analogRead(redPinSensor). Just write "redPinSensor = 0" because analogRead can only* read analog Pins.

That then leads to confusion as to which pin 0 you mean. Better, in my opinion, to use the unique names for the pins as marked on the board.

I strongly agree with UKHeliBob. Using 'A0' is preferred over '0' for an analog pin.