I am controlling a solar tracker, and it needs to be reset every 10 minutes or it loses its mind. My program works fine, controlling power relays, so I have added I2C&Power to be able to see the status remotely. For now it is set up on the workbench with fairly short cables. I also have a RTC and the i2cscanner finds them all..
LCD init code is pretty basic:
// 20 x 4 LCD Display #include LiquidCrystal_I2C.h // set the LCD address to 0x3F for a 20 chars 4 line display\/ Set the pins on the I2C chip used for LCD connections: // addr, en,rw,rs,d4,d5,d6,d7,bl,blpol LiquidCrystal_I2C lcd(0x3f, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);
lcd.begin(20,4); lcd.clear(); lcd.setCursor(2,0); lcd.print("PV Control 3.9");
My LCD (20x4) works fine at first, writing the top line with the name of the program, then the bottom line with a temperature reading, then every 10 minutes I need the second line to show when the power is off for 10 seconds. It shows "power off" just fine, but after the delay(10000) it is supposed to overwrite that line with "power on" but nothing changes...
Serial.println("POWER OFF"); lcd.setCursor(4,1); lcd.print("-Power Off- "); digitalWrite(power1,HIGH); // DC HOUSE power off digitalWrite(power2,HIGH); // DC HOUSE power off delay(10000); Serial.println("POWER ON"); lcd.setCursor(4,1); lcd.print("-Power On- "); digitalWrite(power1,LOW); // DC HOUSE power on digitalWrite(power2,LOW); // DC HOUSE power on
The problem is that it continues to say "power off" and doesn't overwrite it.
I can see from the Serial Monitor that the program is running fine, but the LCD doesn't change after the first set of lcd.prints at those character positions.
I haven't heard of anybody having this problem, but perhaps someone out there know about this. Any suggestions would be very welcome.
Question is: How can I make the LCD update lines that have been originally written?
UPDATE: Problem solved by simply clearing and rewriting the display when things change. I can't debug libraries but at least it is working now.