#include <LiquidCrystal_I2C.h>
// Set the LCD address to 0x27 for a 16 chars and 2 line display
LiquidCrystal_I2C lcd(0x27, 16, 2);
int valeurLue;
float tension;
void setup()
{
pinMode(4, OUTPUT);
Serial.begin(9600);
lcd.init();
lcd.backlight();
lcd.print("Hello, world!");
}
void loop()
{
valeurLue = analogRead(A0);
tension = valeurLue * 5.0 / 1023;
lcd.clear();
lcd.print("Tension = ");
lcd.print(tension);
lcd.print(" V");
digitalRead(A0);
if (tension < 2.5) {
digitalWrite(4 , HIGH);
}
if (tension >= 4.5) {
digitalWrite(4 , LOW);
}
delay(500);
}