Hi guys and girls,
could you please help me with my project?
I want to show current readings from sensor on LCD.
watering is working and everything else, I just couldn't get sensor value on LCD.
I also wonder how can I show it as percentage on LCD. For instance - completely wet soil = 100% , medium = 50%, super dry = 0%. yeah, something like that.
here is code:
could you please help me with my project?
I want to show current readings from sensor on LCD.
watering is working and everything else, I just couldn't get sensor value on LCD.
I also wonder how can I show it as percentage on LCD. For instance - completely wet soil = 100% , medium = 50%, super dry = 0%. yeah, something like that.
here is code:
C:
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,20,4);
int PUMP = 13;
int sensor = 8;
int val;
const int DigitalInPin = 8;
int sensorValue = digitalRead(8);
void setup() {
pinMode(13,OUTPUT);
pinMode(8,INPUT);
lcd.init(); // initialize the lcd
lcd.init();
delay(100);
}
void loop() {
val = digitalRead(8);
if(val ==LOW)
{
digitalWrite(13,LOW);
}
else
{
digitalWrite(13,HIGH);
}
delay(400);
lcd.backlight();
lcd.setCursor(0,0);
lcd.print("Soil Moisture:");
sensorValue = digitalRead(8);
lcd.setCursor(0, 1);
lcd.print(sensorValue);
}
Attachments
-
233.2 KB Views: 10
-
137.7 KB Views: 8
Last edited by a moderator: