LM35 simulate POTENTIOMETER

hi I am new to arduino, and I have many problems with my logic, in this program I want a led to turn on if the value is> = 25 and turn off if it is not, I am using proteus to simulate, when I place the value above 3 turns on, and if it is less than 3 it turns off, I don't understand why it doesn't work with the value I want.
guide me :frowning:

int value;
int led0 = 0;

 
void setup() {
  Serial.begin(9600);
  pinMode(led0, OUTPUT);

}
 
void loop() {
  value= analogRead(A4);
  
  if(value>= 26 )
  {
      digitalWrite(led0, HIGH);
      
  } 
  
  if (value<= 25 )
  {
      digitalWrite(led0, LOW);
     
  }
 

}

Have you tried printing value before testing it ?
Do you see what you expect ?

What part does the LM35 play in your project ?
A circuit diagram would help to understand what you are doing

this is my diagram,LM35 will be the one that is simulated with the potentiometer, What I am trying to do is start the potentiometer with a value for example 25, and if I raise the value to more than 25 the led turns on, otherwise the led turns off.

Depending on which LM35 you have, the output is about 10mV per degree C. What are you seeing and why do you think the 10mV will be what you simulated?
Paul

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