// Define the analog pin, the LM35's Vout pin is connected to #define sensorPin A0 void setup() { // Begin serial communication at 9600 baud rate Serial.begin(9600); } void loop() { // Get the voltage reading from the LM35 int reading = analogRead(sensorPin); // Convert that reading into voltage float voltage = reading * (3.3 / 4096.0); // follow ESP32 & LM35 code on http://www.esp32learning.com/code/esp32-and-lm35-temperature-sensor.php // Convert the voltage into the temperature in Celsius float temperatureC = voltage * 100; // Print the temperature in Celsius Serial.print("Temperature: "); Serial.print(temperatureC); Serial.print("\xC2\xB0"); // shows degree symbol Serial.print("C | "); // Print the temperature in Fahrenheit float temperatureF = (temperatureC * 9.0 / 5.0) + 32.0; Serial.print(temperatureF); Serial.print("\xC2\xB0"); // shows degree symbol Serial.println("F"); delay(1000); // wait a second between readings }