#include <Adafruit_LiquidCrystal.h>
unsigned long previousMillis = 0;
bool stav = true;
bool striedanieretazca=true;
String retazec1 ="SPS IT IG";
String retazec2 ="TVRDOSIN";
Adafruit_LiquidCrystal lcd(0);
/*byte customChar0[8] = {
0b01010,
0b00100,
0b00110,
0b01000,
0b00100,
0b00010,
0b01100,
0b00000
};
byte customChar1[8] = {
0b00011,
0b00000,
0b00100,
0b00100,
0b00100,
0b00100,
0b00100,
0b00000
};*/
void setup() {
lcd.begin(16, 2);
lcd.setBacklight(HIGH);
Serial.begin(9600);
}
void loop() {
unsigned long currentMillis = millis();
if(currentMillis - previousMillis >=2000){
previousMillis = currentMillis;
stav=!stav;
lcd.clear();
}
(stav)?zobraz1():zobraz2();
if (Serial.available()>0) {
String novytext=Serial.readString();
novytext.trim();
(striedanieretazca)?retazec1=novytext:retazec2=novytext;
striedanieretazca=!striedanieretazca;
}
}
void zobraz1()
{
lcd.setCursor(0,0);
lcd.print(retazec2);
lcd.setCursor(16-retazec1.length(),1);
lcd.print(retazec1);
}
void zobraz2()
{
lcd.setCursor(16-retazec2.length(),0);
lcd.print(retazec2);
lcd.setCursor(0,1);
lcd.print(retazec1);
}