Created
November 29, 2020 12:13
-
-
Save JayateerthDambal/60aec9713d296c0d0477a3df85399dd9 to your computer and use it in GitHub Desktop.
Arduino Code for LM35 by Jayateerth Dambal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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