Answers for "lm35 lcd i2c arduino"

0

lm35 lcd i2c arduino

// code arduino lcd_i2c + LM35 By Zouari Mehdi

#include <Arduino.h>

#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2); // set the LCD address to 0x27 for a 16 chars and 2 line display
int val;
const int tempPin = A0;
void setup()
{
  Serial.begin(9600);
  lcd.init(); // initialize the lcd
  // Print a message to the LCD.
  lcd.backlight();
  lcd.setCursor(1, 0);
  lcd.print("hello everyone");
  lcd.setCursor(1, 1);
  lcd.print("Zouari Mehdi");
  delay(1000);
  lcd.clear();
}
void loop()
{
  val = analogRead(tempPin);
  float temprature = (val / 1024.0) * 500;
  Serial.print("TEMPRATURE= ");
  Serial.print(temprature);
  lcd.setCursor(0, 0);
  lcd.print("temprature");
  lcd.setCursor(11, 0);
  lcd.print(temprature);
}

// By Zouari Mehdi
Posted by: Guest on April-15-2022

Browse Popular Code Answers by Language