/* Arduino TMP37 Centigrade Temperature Sensor Tutorial https://www.bristolwatch.com/arduino/arduino_tmp37.htm by Lewis Loflin lewis@bvu.net */ /* LiquidCrystal Library Demonstrates the use a 16x2 LCD display. The LiquidCrystal library works with all LCD displays that are compatible with the Hitachi HD44780 driver. */ // include the library code: #include char myString[10]; // initialize the library with // the numbers of the interface pins LiquidCrystal lcd(12, 11, 5, 4, 3, 2); void setup() { // set up the LCD's number of columns and rows: lcd.begin(16, 2); } void loop() { int sensorValue = analogRead(0); // convert ADC value to volts float volts = sensorValue * 5.0 / 1024 ; // convert volts to Celsius 20mV per degree float Celsius = volts / .02 ; // conversion from Celsius to Fahrenheit float Fahrenheit = (Celsius * 9.0 / 5.0) + 32; lcd.home(); lcd.print(Fahrenheit); lcd.print(" deg. F"); // lcd.print(" "); delay(200); } ------------------------------------------ /* Arduino TMP37 Analog Temperature Sensor with I2C LCD Display https://www.bristolwatch.com/arduino/tmp37_i2c_arduino.htm By Lewis Loflin lewis@bvu.net Make sure these libraries are present. This uses an I2C LCD display. */ #include #include #include LiquidCrystal_I2C lcd(0x27, 16, 2); // set the LCD address to 0x27 void setup() { lcd.init(); // initialize the lcd lcd.backlight(); } // end setup void loop() { int sensorValue = analogRead(0); // convert ADC value to volts float volts = sensorValue * 5.0 / 1024 ; // convert volts to Celsius 20mV per degree float Celsius = volts / .02 ; // conversion from Celsius to Fahrenheit float Fahrenheit = (Celsius * 9.0 / 5.0) + 32; lcd.home(); lcd.print(Fahrenheit); lcd.print(" deg. F"); // lcd.print(" "); delay(200); } // end loop