Temprature sensor guide

I am 14 years old and a beginner and i new to sensors so please can any bod give me guidance Regarding how to turn on and off a led when i reach a specific temperature For Example when its 50 Celsius led turns off else it keep on.

int pin = 0;
int tempc = 0;
int samples [5];
int i ;// variable 

void setup(){

  Serial.begin (9600); // is used to activate serial comunication via usb 
}

void loop(){
  //this equation is used to calculate the temp using 5v as reference 
  for (i= 0 ; i<=4;i++){
    samples[i] = (5.0 * analogRead(pin)*100.0)/1183.0;//1023
    tempc = tempc + samples[i];
    delay(50);
  }
  { 
    tempc= tempc/5.0;
Serial.println ("celsious"); // celcious is what this temperature represent 
    Serial.println (tempc,DEC); //this is used so that the serial is show what to write in this case it is temperature
    delay (50); //0.5 miliseconds 
  }
}

I'm not clear whether you actually have a sensor - if so please tell us what it is.

If you are wondering what sensor to use I suggest you consider either an LM35 or LM335. They are cheap and very easy to use.

...R

Hi, You need to use an if.. else statement

if temp is greater than 50 turn LED FF else turn LED ON

https://www.arduino.cc/en/Reference/Else

will help..

As Robin2 has asked, what are you using to sense temp.

Tom... :)

Most simple case

 digitalWrite(ledPin, tempc > 50);