L’Arduino et l’écran que je l’ai acheté sur Ebay.
L’affichage a été autour 8usd.
Le LM35 vous pouvez l’obtenir à n’importe quel magasin d’électronique, pour, au maximum 1.
J’ai utilisé la bibliothèque liquidCrystal_I2C et le wire.h.
Voici la programmation :
#include < Wire.h >
#include < LiquidCrystal_I2C.h > //libraries
termo int = A0 ;
boton int = 5 ;
int estadoboton = 0 ;
LiquidCrystal_I2C lcd(0x27,16,2) ;
void setup()
{
pinMode(boton,INPUT) ;
LCD.init() ; initialiser l’écran lcd
Serial.Begin(9600) ;
LCD.Print("TEMPERATURA") ;
LCD.backlight (); //enciendo la luz del LDC
Delay(250) ;
lcd.noBacklight (); //apago la luz del LCD
Delay(250) ;
LCD.backlight() ;
}
void loop()
{
estadoboton=digitalRead(Boton) ;
Si (Serial.available()) {}
Delay(100) ;
LCD.Clear() ;
tandis que (Serial.available() > 0) {}
LCD.Write(Serial.Read()) ;
}
}
if(estadoboton ==High) {}
float temperatura=analogRead(termo) ;
float tempF=(((temperatura*500)/1024)*1.8)+32) ;
Serial.Print("temperatura") ;
Serial.println(tempF) ;
lcd.setCursor(11,0) ;
LCD.Print(tempF) ;
lcd.setCursor(1,1) ;
LCD.Print("Farenheit") ;
Delay(500) ;
}
{if(estadoboton==Low)}
float temperatura=analogRead(termo) ;
float tempC=((temperatura*500)/1024) ;
Serial.Print("temperatura") ;
Serial.println(tempC) ;
lcd.setCursor(11,0) ;
LCD.Print(tempC) ;
lcd.setCursor(1,1) ;
LCD.Print (« Celsius ») ;
Delay(500) ;
}
}