Skip to content

Instantly share code, notes, and snippets.

@JayateerthDambal
Created November 29, 2020 12:13
Show Gist options
  • Save JayateerthDambal/60aec9713d296c0d0477a3df85399dd9 to your computer and use it in GitHub Desktop.
Save JayateerthDambal/60aec9713d296c0d0477a3df85399dd9 to your computer and use it in GitHub Desktop.
Arduino Code for LM35 by Jayateerth Dambal
int lm =A1;
void setup() {
Serial.begin(9600);
pinMode(lm,INPUT);
}
void loop() {
int value = analogRead(lm);
Serial.print("Value: ");
Serial.println(value); // Prints the Anlaog value read by the sensor
float celcius = (value*500)/1023; // In Degree celcius
float fahren = (celcius*1.8)+32; // In fahrenheit
Serial.print("Temperature in Degree Celcius = ");
Serial.print("\t");
Serial.print(celcius);
Serial.print("\t");
Serial.print("Temperature in Fahrenheit = ");
Serial.print("\t");
Serial.print(fahren);
delay(3000); /// Delay of 3 Seconds
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment