In function 'void loop()': problem with two projects

Hi guys, I keep getting the same errors in two different projects

they all seem to be related to this one:

In function ‘void loop()’:

Here are the codes, and bellow the list of errors. Im very very beginner and don’t have a clue on where’s the error. Tks

3rd project Rduino Starter Kit

const int sensorPin = A0;

const float baselineTemp = 20.0;

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

for(int pinNumber = 2; pinNumber<5; pinNumber++ ){
pinMode(pinNumber, OUTPUT);
digitalWrite(pinNumber, LOW);

}

}
void loop()
{
int sensorVal = analogRead(sensorPin);
Serial.print("Sensor Value: ");
Serial.print(SensorVal);

float voltage = (sensorVal/1024.0) * 5;

Serial.print(", Volts: ");
Serial.print(voltage);

Serial.print (", degrees C:");

float temperature = (voltage - .5) = 100;
Serial.println(temperature);

if(temperature < baselineTemp){
digitalWrite(2, HIGH);
digitalWrite(3, LOW);
digitalWrite(4, LOW);

} else if(temperature >= baselineTemp+2 && temperature < baselineTemp+4){
digitalWrite(2, HIGH);
digitalWrite(3, HIGH);
digitalWrite(4, LOW);

} else if (temperature >=baselineTemp+6){
digitalWrite(2, HIGH);
digitalWrite(3, HIGH);
digitalWrite(4, HIGH);

}

delay(1);

}

ERRORS:

Love_Meter.ino: In function ‘void loop()’:
Love_Meter.ino:20:14: error: ‘SensorVal’ was not declared in this scope
Love_Meter.ino:29:36: error: lvalue required as left operand of assignment
Error compiling.

Project 4 Color Mixing Lamp

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

const int redSensor = A0;
const int greensensorPin = A1;
const int clueSensorPin = 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(”| 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);
}

ERRORS:

ColorMixing_sketch_feb17a.ino: In function ‘void loop()’:
ColorMixing_sketch_feb17a.ino:29:3: error: ‘redsensorValue’ was not declared in this scope
ColorMixing_sketch_feb17a.ino:29:31: error: ‘redSensorPin’ was not declared in this scope
ColorMixing_sketch_feb17a.ino:31:33: error: ‘greenSensorPin’ was not declared in this scope
ColorMixing_sketch_feb17a.ino:33:3: error: expected ‘;’ before ‘blueSensorValue’
ColorMixing_sketch_feb17a.ino:38:33: error: expected ‘;’ before ‘:’ token
ColorMixing_sketch_feb17a.ino:40:18: error: ‘blueSensorValue’ was not declared in this scope
ColorMixing_sketch_feb17a.ino:51:28: error: expected ‘;’ before ‘:’ token
Error compiling.

Capitalization is quite important.

SensorVal is NOT the same as sensorVal.

I don't know what you meant with

float temperature = (voltage - .5) = 100;

but I don't think that you intended to have two equal signs. You cannot set (voltage - .5) to the value 100.

Please notice that each error message contains the number of the line that it thinks the error is on, and the character position that it thinks is wrong. Of course, these are the line numbers AFTER the Arduino IDE has preprocessed the file.

Good Luck!

Yeah, the right way was SensorValue but still, the same error persists...

tks though

Take a good look atbevery occurrence of the variables mentioned in the errors. There are two more that are related to capitalization or spelling not matching. You gotta at least try.

It's probably this:

 Serial.print(greenSensorValue):

(look closely)

vaj4088:
SensorVal is NOT the same as sensorVal.

pk__:
Yeah, the right way was SensorValue......

Was it? :-

int sensorVal = analogRead(sensorPin);
Serial.print("Sensor Value:  ");
Serial.print(SensorVal);

There are plenty of similar mistakes. Go over your code carefully and fix them.
As everyone else has mentioned, take careful note of your capitalisation.

Thanks guys!!!

The problem with sensorVal was resolved!!! The right way was “s”!

Altough I keep getting this strange void error and invalue:

Love_Meter.ino: In function ‘void loop()’:
Love_Meter.ino:28:36: error: lvalue required as left operand of assignment

I’ve gone line by line… Can’t figure it out! I just wrote another code and the problem persists only with this in function ‘void loop()’:

:frowning: going mad here…

You mean this line?

float temperature = (voltage - .5) = 100;

Well, what's it supposed to do?

(did you see how I used code tags too?)

pk__:
Love_Meter.ino: In function 'void loop()':
Love_Meter.ino:28:36: error: lvalue required as left operand of assignment

I've gone line by line...

You don't have to search line by line. The error message tells you what line to look at, in this case line 28 it says. The IDE even highlights it for you.