#include <Wire.h>
#include <LiquidCrystal_I2C.h>
/*
// Set the LCD address to 0x27 for a 16 chars and 2 line display this
// this has begging and ending box
LiquidCrystal_I2C lcd(0x27, 16, 2);
// Messages to display
const char* messages[] = {
"African Holding",
"group",
"Godo housing and",
"smart realestate",
"We build modern",
"lifestyle",
"1+8 >9"
};
const int numMessages = sizeof(messages) / sizeof(messages[0]);
// Custom characters
byte topLeftCorner[8] = {0x00,0x00,0x0F,0x18,0x10,0x10,0x10,0x10};
byte topRightCorner[8] = {0x00,0x00,0x1E,0x03,0x01,0x01,0x01,0x01};
byte bottomLeftCorner[8] = {0x10,0x10,0x10,0x10,0x18,0x0F,0x00,0x00};
byte bottomRightCorner[8] = {0x01,0x01,0x01,0x01,0x03,0x1E,0x00,0x00};
byte verticalLine[8] = {0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10};
byte horizontalLine[8] = {0x00,0x00,0x00,0x1F,0x1F,0x00,0x00,0x00};
byte loadingBar[8] = {0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F};
void setup() {
// Initialize the LCD
lcd.init();
// Turn on the backlight
lcd.backlight();
// Create custom characters
lcd.createChar(0, topLeftCorner);
lcd.createChar(1, topRightCorner);
lcd.createChar(2, bottomLeftCorner);
lcd.createChar(3, bottomRightCorner);
lcd.createChar(4, verticalLine);
lcd.createChar(5, horizontalLine);
lcd.createChar(6, loadingBar);
}
void loop() {
for (int i = 0; i < numMessages; i += 2) {
lcd.clear();
drawBorder();
// Display first line
displayCentered(messages[i], 0);
// Display second line if available
if (i + 1 < numMessages) {
displayCentered(messages[i + 1], 1);
}
delay(2000); // Wait for 2 seconds before next message
animateTransition();
}
}
void drawBorder() {
lcd.setCursor(0, 0);
lcd.write(byte(0));
lcd.setCursor(15, 0);
lcd.write(byte(1));
lcd.setCursor(0, 1);
lcd.write(byte(2));
lcd.setCursor(15, 1);
lcd.write(byte(3));
for (int i = 1; i < 15; i++) {
lcd.setCursor(i, 0);
lcd.write(byte(5));
lcd.setCursor(i, 1);
lcd.write(byte(5));
}
}
void displayCentered(const char* message, int row) {
int len = strlen(message);
int padding = (14 - len) / 2;
for (int j = 0; j < 14; j++) {
lcd.setCursor(j + 1, row);
if (j < padding || j >= padding + len) {
// Display cursor for padding
lcd.write(0xFF); // Solid block character
delay(50);
lcd.setCursor(j + 1, row);
lcd.write(' ');
} else {
// Display cursor for text
lcd.write(0xFF); // Solid block character
delay(200);
lcd.setCursor(j + 1, row);
lcd.write(message[j - padding]);
}
delay(50);
}
}
void animateTransition() {
for (int i = 0; i < 16; i++) {
lcd.setCursor(i, 0);
lcd.write(byte(6));
lcd.setCursor(i, 1);
lcd.write(byte(6));
delay(50);
}
delay(200);
for (int i = 15; i >= 0; i--) {
lcd.setCursor(i, 0);
lcd.write(' ');
lcd.setCursor(i, 1);
lcd.write(' ');
delay(50);
}
}
// ||||||||||||||||||||||||||||||||||||||||||||||\\\\
// this is the normal display
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
// Set the LCD address to 0x27 for a 16 chars and 2 line display
LiquidCrystal_I2C lcd(0x27, 16, 2);
// Messages to display
const char* messages[] = {
"African Holding",
"group",
"Godo housing and",
"smart realestate",
"We build modern",
"lifestyle",
"1+8 >9"
};
const int numMessages = sizeof(messages) / sizeof(messages[0]);
void setup() {
// Initialize the LCD
lcd.init();
// Turn on the backlight
lcd.backlight();
}
void loop() {
for (int i = 0; i < numMessages; i += 2) {
lcd.clear();
// Display first line
displayCentered(messages[i], 0);
// Display second line if available
if (i + 1 < numMessages) {
displayCentered(messages[i + 1], 1);
}
delay(2000); // Wait for 2 seconds before next message
}
}
void displayCentered(const char* message, int row) {
int len = strlen(message);
int padding = (16 - len) / 2;
for (int j = 0; j < 16; j++) {
lcd.setCursor(j, row);
if (j < padding || j >= padding + len) {
// Display cursor for padding
lcd.write(0xFF); // Solid block character
delay(50);
lcd.setCursor(j, row);
lcd.write(' ');
} else {
// Display cursor for text
lcd.write(0xFF); // Solid block character
delay(200);
lcd.setCursor(j, row);
lcd.write(message[j - padding]);
}
delay(50);
}
}
// ||||||||||||||||||||||||||||||||||||||||||||||||||\\\\\\\\\\\\\\\\\\\\\\\\
*/
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
// Set the LCD address to 0x27 for a 16 chars and 2 line display
LiquidCrystal_I2C lcd(0x27, 16, 2);
byte chr[3][8][8] = {
{
{0x00, 0x00, 0x00, 0x00, 0x03, 0x07, 0x0E, 0x0E},
{0x00, 0x00, 0x00, 0x00, 0x0F, 0x1F, 0x1F, 0x1F},
{0x00, 0x00, 0x00, 0x03, 0x07, 0x1F, 0x1F, 0x1F},
{0x00, 0x00, 0x05, 0x1F, 0x1D, 0x1F, 0x16, 0x06},
{0x0C, 0x18, 0x10, 0x00, 0x01, 0x01, 0x01, 0x00},
{0x1F, 0x1F, 0x1E, 0x17, 0x00, 0x00, 0x10, 0x00},
{0x1F, 0x1F, 0x03, 0x02, 0x14, 0x04, 0x02, 0x00},
{0x1C, 0x1C, 0x04, 0x04, 0x08, 0x00, 0x00, 0x00}
},
{
{0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0F, 0x1E},
{0x00, 0x00, 0x00, 0x00, 0x0E, 0x1F, 0x1F, 0x1F},
{0x00, 0x00, 0x00, 0x01, 0x07, 0x1F, 0x1F, 0x1F},
{0x00, 0x05, 0x1F, 0x1D, 0x1F, 0x1B, 0x13, 0x10},
{0x13, 0x03, 0x06, 0x0C, 0x10, 0x10, 0x00, 0x00},
{0x1F, 0x17, 0x06, 0x0C, 0x10, 0x10, 0x00, 0x00},
{0x1F, 0x1F, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00},
{0x10, 0x18, 0x1C, 0x08, 0x08, 0x00, 0x10, 0x00}
},
{
{0x00, 0x00, 0x00, 0x07, 0x0F, 0x0E, 0x1C, 0x18},
{0x00, 0x00, 0x00, 0x0F, 0x1F, 0x1F, 0x1F, 0x1F},
{0x00, 0x00, 0x01, 0x03, 0x1F, 0x1F, 0x1F, 0x1F},
{0x14, 0x1C, 0x1A, 0x1E, 0x1F, 0x13, 0x10, 0x10},
{0x13, 0x13, 0x02, 0x02, 0x04, 0x00, 0x00, 0x00},
{0x1F, 0x07, 0x0E, 0x06, 0x01, 0x00, 0x00, 0x00},
{0x0F, 0x03, 0x03, 0x01, 0x01, 0x00, 0x00, 0x00},
{0x10, 0x18, 0x0C, 0x02, 0x02, 0x11, 0x00, 0x00}
}
};
// Messages to display
const char* messages[] = {
"African Holding",
"group",
"Godo housing and",
"smart realestate",
"We build modern",
"lifestyle",
"1+8 > 9"
};
const int numMessages = sizeof(messages) / sizeof(messages[0]);
void setup() {
// Initialize the LCD
lcd.init();
// Turn on the backlight
lcd.backlight();
}
void loop() {
for (int i = 0; i < numMessages; i += 2) {
lcd.clear();
// Display first line
displayCentered(messages[i], 0);
// Display second line if available
if (i + 1 < numMessages) {
displayCentered(messages[i + 1], 1);
}
delay(2000); // Wait for 2 seconds before horse animation
// Horse animation
int x1 = -4; // Start off-screen to the left for first horse
int x2 = -9; // Start further left for second horse
while (x1 <= 16) { // Run until the first horse is off-screen to the right
// Create characters for the current frame
for (int j = 0; j < 8; j++) {
lcd.createChar(j, chr[(x1/2) % 3][j]); // Use integer division to slow down animation
}
// Clear the area behind the horses
for (int c = 0; c < 8; c++) {
int xc1 = x1 + c - 1; // Calculate cursor position for first horse
int xc2 = x2 + c - 1; // Calculate cursor position for second horse
if (xc1 >= 0 && xc1 < 16) {
lcd.setCursor(xc1, 0);
lcd.write(' ');
lcd.setCursor(xc1, 1);
lcd.write(' ');
}
if (xc2 >= 0 && xc2 < 16) {
lcd.setCursor(xc2, 0);
lcd.write(' ');
lcd.setCursor(xc2, 1);
lcd.write(' ');
}
}
// Display first horse characters
for (int c = 0; c < 4; c++) {
int xc = x1 + c; // Calculate cursor position
if (xc >= 0 && xc < 16) {
lcd.setCursor(xc, 0);
lcd.write(byte(c));
lcd.setCursor(xc, 1);
lcd.write(byte(c + 4));
}
}
// Display second horse characters
for (int c = 0; c < 4; c++) {
int xc = x2 + c; // Calculate cursor position
if (xc >= 0 && xc < 16) {
lcd.setCursor(xc, 0);
lcd.write(byte(c));
lcd.setCursor(xc, 1);
lcd.write(byte(c + 4));
}
}
delay(200); // Delay for a while before moving to the next position
x1++; // Move first horse to the right for the next frame
x2++; // Move second horse to the right for the next frame
}
}
}
void displayCentered(const char* message, int row) {
int len = strlen(message);
int padding = (16 - len) / 2;
for (int j = 0; j < 16; j++) {
lcd.setCursor(j, row);
if (j < padding || j >= padding + len) {
// Display cursor for padding
lcd.write(0xFF); // Solid block character
delay(50);
lcd.setCursor(j, row);
lcd.write(' ');
} else {
// Display cursor for text
lcd.write(0xFF); // Solid block character
delay(200);
lcd.setCursor(j, row);
lcd.write(message[j - padding]);
}
delay(50);
}
}