Of course, complete code, where lcd.print(" "); won't delete old text :
#include <Wire.h>
#include <LiquidCrystal.h> // includes the LiquidCrystal Library
LiquidCrystal lcd(32, 30, 28, 26, 24, 22);
//LiquidCrystal lcd_name(rs, en, d4, d5, d6, d7);
int previousLCDMillis = 0; //set first old time to 0
void setup() {
//My LCD was 16x2
lcd.begin (16, 2);
lcd.home(); // go home
}
void loop() {
//bunch of other stuff here
kalba();
}
void kalba() {
//function telling users they should select the language
//four languages should switch between with the delay of 2 sec.
unsigned long currentLCDMillis = millis(); //check current time
unsigned long interval2 = 2000;
static unsigned long previousLCDMillis = 0; //set first old time to 0
String languages[4] = {"Kalba?", "Language?", "Runa?", "Y3Ik?"};
int langCycle = 0; //cycle is 0, it is used and waits for millis to hit 2000
if (currentLCDMillis - previousLCDMillis > interval2) {
langCycle++;
lcd.setCursor (6, 0);
lcd.print(" "); //delete the old text - DOES NOT WORK
previousLCDMillis = currentLCDMillis;
}
lcd.setCursor (6, 0);
lcd.print(languages[langCycle]);
if (langCycle == 3) {
langCycle = 0;
}
}