'celcius' was not declared in this scope

Hello, i tried to make temperature controlled relay

I got this sketch from the internet, but the error message says

'celcius' was not declared in this scope <<<<

what to do?

#include <LiquidCrystal.h>
int reading = 0;
int sensorPin = A0;
int relay =7;
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
 
void setup() {
  // set up the LCD's number of columns and rows: 
  lcd.begin(16, 2);
  // Print a message to the LCD.
 pinMode(relay,OUTPUT);
}
 
void loop() {
  // set the cursor to column 0, line 1
  // (note: line 1 is the second row, since counting begins with 0):
  reading = analogRead(sensorPin);
 int celsius = reading/2;
  lcd.setCursor(0, 0);
  lcd.print("Temperature: ");
  // print the number of seconds since reset:
  lcd.setCursor(0,1);
  lcd.print(celsius, DEC);
  lcd.print((char)223);
  lcd.print("C");
  if (celcius >35);
  {
    digitalWrite(7,HIGH);
  }
  else
  
  {digitalWrite(7,LOW);
  }
  delay(500);
  lcd.clear();
}

The man was called Anders Celsius (hint)

lcd.print(celsius, DEC);
lcd.print((char)223);
lcd.print("C");
if (celcius >35);

I see at least 2 errors.

  // print the number of seconds since reset:

What part of your code does THAT?

ctrl-F is a great tool (search) just type in what ever its complaining about then hit find

To a computer celsius and celcius are two differant things. Whereas a human can interpret them as the same.
A simple typo can simply make your program/sketch/script give a wrong value or crash or in the case of the RTM worm written by Robert Tappen Morris in the 1990'S turn a messaging worm into a plaque.

It happens to all of us. One way of checking is to print out your script and use a pen or marker check off your code especially variable names - we often use names such as trivol for triangle volume as it uses less characters

Thank you all

My eyes must be blind to see the different :smiley:

it works now

I'm pretty sure it's not working.
It may appear to be working, but it's really not.

if (celcius >35);

that's a complete statement. Nothing is done with the info. Your following commands have no relation to that part.

we often use names such as trivol for triangle volume as it uses less characters

Those of us that know what we are doing would use triVol.

. . . and most of us would wonder how a two-dimensional object can have a volume.

INTP:
I'm pretty sure it's not working.
It may appear to be working, but it's really not.

if (celcius >35);

that's a complete statement. Nothing is done with the info. Your following commands have no relation to that part.

It works actually

Onchyzuki:
It works actually

For some incorrect definition of "works".

Onchyzuki:
It works actually

It "works" just like:

  if (celcius >35)
  {}

"works"

Onchyzuki the people on here are not being rude or unhelpful. They are trying to get you to see the error for yourself. If you say it works then you most probably have already fixed the error with out realizing what the error was. By learning the errors in your code you probably wont repeat them.

something as simple as ; tells the compiler what to do with the code

so

if (celcius >35);

what you have typed here is

if celcuis is bigger than 35 I am done with this statement.

The compiler would look at that and say its a waste of code as it does nothing then delete it before loading the program to the board

What you wanted to say was

if (celcius >35) {

//do something

}

If pin 7 is switching between high and low you probably already fixed the code so just let us know that you see the error and understand what the error was.