# How do you get the reading from the sensor?

I am trying to program the arduino but I have no idea what it is reading from the sensor, is it referring to a formula or something like that? according to me it would be like this
TempC=5÷ 1024* lectura* 100- 5
or I'm wrong?

according to what my teacher put in the pdf that he sent me

it's a temperature sensor

We know.
You keep telling us

Int tempo= 0;
Float temperatura= 0.0;
void setup ()
{
Serial.begin(9600);
}
void loop(){
temperature= (0*(500.0/1023.0))-50.0
Serial.printlin(temperature);
Delay(500);
}

I still can't get the fan to work TT

This is the first time you have mentioned a fan.

Ask your teacher to look at this post and provide the project requirments .

Hi, I did it but since I go to school for two days it is difficult to ask for extra help to program it. Maybe watch more youtube videos to finish i

t. I attach the image of tinkecard to give you an idea

Anything multiplied by zero is ...?

This is not an installation issue.

1 Like

What about the missing semicolon ';' at the end which would be necessary for any successful compilation of that code.

1 Like

Your post was MOVED to its current location as it is more suitable.

1 Like

In C that would more like:

``````  // -5 + 100°C per volt
// Temperature = -5 + (volts * 100)
TempC = -5 + ((lectura * 5.0) / 1024.0) * 100;
``````

Warning: Although you might think that
` TempC = -5 + ((lectura * 500) / 1024.0);`
would get the same answer, "lectura * 500" will overflow on an AVR Arduino like the UNO or Nano. An int can only hold up to 32767 so when 'lectura' goes above 65 the multiplication will overflow. Instead use:
` TempC = -5 + ((lectura * 500L) / 1024.0);`
The 'L' on '500L' tells the compiler to use 'long int' instead of 'int' when doing the math.

1 Like

I already got help and was able to finish it, I hope I can get a good grade

Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'

Use code tags (the </> icon above the compose window) to make it easier to read and copy for examination

1 Like

analogRead returns an int, not a float, and tempC does not require global scope.

SENSOR and MOTOR should both be "const byte".

You should maybe Google the concept "hysteresis".

But well done, you got there.

(Maybe post code, not pictures of code in future)

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.