Project #3 - Love-O-Meter

I am new to Arduino and am working my way through the project book. I am having trouble with the coding from Project #3. I have typed and re-typed the code and still run into the same problem when verifying: ‘baseline’ was not declared in this scope. I have attached a screen shot of the error. Thanks

Posting code is better. Like the compiler, I can't see "baseline" either.

Here is the entire code:
const int sensorPin = A0;
const float baselineTemp = 20.0;
void setup (){
Serial.begin(9600); //open serial port
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);
// convert the ADC reading to voltage
float voltage = (sensorVal/1024.0) * 5.0;
Serial.print(”, Volts:”);
Serial.print(voltage);
Serial.print(",degrees C:");
// convert the voltage to temerpature in degrees
float temperature = (voltage - .5) * 100;
Serial.println(temperature);
if(temperature < baselineTemp){
digitalWrite(2, LOW);
digitalWrite(3, LOW);
digitalWrite(4, LOW);
}else if(temperature >= baselineTemp+2 &&
temperature < baseline+4){
digitalWrite(2, HIGH);
digitalWrite(3, LOW);
digitalWrite(4, LOW);
}else if(temperature >=baselineTemp+4 && temperature < baselineTemp+6){
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);
}

So, nothing called "baseline", when "baselineTemp" is used everywhere else.

Please use code tags when posting code.

Sorry, I'm new to all of this, so bare with me. What are code tags and how do I use them and post them? I typed the code word for word from the book and have re-typed it twice with the same results.

The clue is

nothing called "baseline", when "baselineTemp" is used everywhere else.

so bare with me

Never on a first date.

Code tags are explained here, in bold at the top of just about every section of the forum.

const int sensorPin = A0;
const float baselineTemp = 20.0;
void setup (){
  Serial.begin(9600); //open serial port
  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);
  // convert the ADC reading to voltage
  float voltage = (sensorVal/1024.0) * 5.0;
  Serial.print(", Volts:");
  Serial.print(voltage);
  Serial.print(",degrees C:");
  // convert the voltage to temerpature in degrees
  float temperature = (voltage - .5) * 100;
  Serial.println(temperature);
  if(temperature < baselineTemp){
    digitalWrite(2, LOW);
    digitalWrite(3, LOW);
    digitalWrite(4, LOW);
  }else if(temperature >= baselineTemp+2 && 
    temperature < baseline+4){
    digitalWrite(2, HIGH);
    digitalWrite(3, LOW);
    digitalWrite(4, LOW);
  }else if(temperature >=baselineTemp+4 && temperature < baselineTemp+6){
    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);
}

Have another look at reply #3.

I'm sorry I am new to this and very unexperienced, but I have no idea which one is reply 3. Please get right to the point and let me know what I need to do to get help with this.

but I have no idea which one is reply 3

It’s the one on this page labelled “Reply #3

The clue is also repeated in reply #5.

Further hints:look carefully at these two snippets of code if(temperature >= baselineTemp+2 &&   temperature < baseline+4)andif(temperature >=baselineTemp+4 && temperature < baselineTemp+6){

Notice any similarities?
Notice any glaring differences?

Not surprisingly, I don’t have the Arduino starter kit, so I can’t verify you copied the code correctly or not.

I do, thank you for the assistance. That worked

OK, thanks for getting back.

Was the code correct in the book, or was there a typo? If in the book, it should be possible to reach the author and get the correction in for the future.

I made the error, the book was correct. I typed the code twice and must have missed it both times.

I have uploaded the code and all 3 lights turn on. I have tried blowing hot air on the sensor and also putting a bag of snow next to the sensor, but all 3 lights remain on. What am I doing wrong?
I found the calibration page on the Arduino website, can I plug that code into the Love-O-Meter code or do I need to calibrate separately?

Fine - glad you got it sorted out.

I’m sorry about the oblique pointers to the solution, but software’s often like that, and it is useful to develop a different way of thinking, and working around the problem, based on what the tools are telling you.

Like what Indiana Jones said in The Last Crusade, “…and ‘X’’ never marks the spot” (even though in his case, it did!)

I have uploaded the code and all 3 lights turn on.

OK, now comes the first tool of debugging - the serial print.
What do they tell you?
(Ignore the lights)

The lights tell me if the temp is above or below the baseline

OK, now comes the first tool of debugging - the serial print. What do they tell you? (Ignore the lights)

Who is they?

This stuff

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

isn't there for decoration.

I'm brand new to this, so I apologize for my lack of knowledge, but I have no idea what you are getting at. I see the line of code on my screen. What are you trying to point out? Is there something I am supposed to change?