#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2); // I2C address 0x27, 16 column and 2 rows
byte customChar[8] = {
0b00100,
0b00100,
0b00100,
0b01110,
0b01110,
0b01110,
0b01110,
0b11111
};
int Pozicia = 0;
int Smer = 1;
void setup()
{
lcd.init(); // initialize the lcd
lcd.backlight();
lcd.createChar(0, customChar); // create a new custom character
lcd.setCursor(0, 0); // move cursor to (2, 0)
lcd.write((byte)0); // print the custom char at (2, 0)
}
void loop()
{
for(int i=0;i<=16;i++){
if( i == Pozicia){
lcd.setCursor(i, 0);
lcd.write((byte)0);
delay(500);
}
else{
lcd.setCursor(i, 0);
lcd.print(" ");
}
}
Pozicia += Smer;
if(Pozicia>=15 || Pozicia<=0){
Smer *= -1;
}
}