hi guys, ive donde a code to show the status of a water pump with 2 motors, if any of the motors is on or off, and it does, it shows if its on or off, but in the screen it flickers a lot, especially the end of the message, the part of "apagada" or "encendida", whats wrong with the code?
#include <LiquidCrystal.h>
LiquidCrystal lcd(7, 8, 9, 10, 11 , 12);
int bomba1 = 1;
int bomba2 = 2;
int emergencia = 3;
int val = 0;
void setup() {
lcd.begin(16, 2);
lcd.setCursor(0, 0);
pinMode(bomba1, INPUT);
pinMode(bomba2, INPUT);
pinMode(emergencia, INPUT);
}
void loop() {
val = digitalRead(bomba1);
if(val == HIGH){
lcd.clear();
lcd.setCursor(0, 0);
lcd.write("bomba1 encendida");
}
else{
lcd.clear();
lcd.setCursor(0, 0);
lcd.write("bomba1 apagada");
}
val = digitalRead(bomba2);
if(val == HIGH){
lcd.clear();
lcd.setCursor(0,1);
lcd.write("bomba2 encendida");
}
else{
lcd.clear();
lcd.setCursor(0, 1);
lcd.write("bomba2 apagada");
}
}