diff --git a/Code_plante_copy_20240411145452/Code_plante_copy_20240411145452.ino b/Code_plante_copy_20240411145452/Code_plante_copy_20240411145452.ino index 54d4660..8a1866c 100644 --- a/Code_plante_copy_20240411145452/Code_plante_copy_20240411145452.ino +++ b/Code_plante_copy_20240411145452/Code_plante_copy_20240411145452.ino @@ -1,10 +1,26 @@ -//code pour la plante connectée -void setup() { - // put your setup code here, to run once: +#include +LiquidCrystal_I2C lcd(0x3F, 16, 2); + +int soil; + +void setup() { + lcd.init(); + lcd.backlight(); + pinMode(soil, INPUT); + Serial.begin(9600); } void loop() { - // put your main code here, to run repeatedly: - -} + int soil = analogRead(A0); + int valeur = map(soil, 0, 1023, 0, 100); //map est une fonction qui permet de passer de 0 à 1023 à 0 à 100 + Serial.println(valeur); // Imprimer la valeur d'humidité sur le moniteur série + Serial.println(soil); + lcd.clear(); // Effacer l'écran LCD avant de mettre à jour + lcd.setCursor(0, 0); + lcd.print("Moisture Value:"); + lcd.setCursor(0, 1); + lcd.print(valeur); + lcd.print(" %"); + delay(500); +} \ No newline at end of file