Temperatur controlling

Hello :slight_smile: We're trying to control a Temperatur sensor. But i seems like it's living it's own life. We are using this cod, can you find anything wrong? Many thanks! :slight_smile:

int temp = A0;

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

}

void loop() {
int kanntemp = analogRead(temp);
float mv = ( kanntemp/1024.0)5000;
float cel = mv/10;
float farh = (cel
9)/5 + 32;

Serial.print("TEMPRATUREN = ");
Serial.print (cel);
Serial.print ("*C");
Serial.println ();
delay(1000);

One thing, it is not posted with code tags. Please read these two posts:

How to use this forum - please read.
and
Read this before posting a programming question ...

We're trying to control a Temperatur sensor.

What, exactly, are you trying to make it do?

We just want the sensor to measure the temperature. But now it's seems like it's just printing out random temperatures... :confused:

What do you see if you print kanntemp ?
How is the sensor wired ?

So, you are not trying to control it. What kind of sensor is it? Why do you think that you can just use analogRead() to read it?

The sensor is called LM35 and we just want it to measure the temperature. Do you have any suggestion which CE-cod we can use?

Julmat:
The sensor is called LM35 and we just want it to measure the temperature. Do you have any suggestion which CE-cod we can use?

From your description, it's more likely that you have a wiring error.