// 22 October 2023
// In Wokwi in the tab "Library Manager" the libraries are added.
// Tip: Write down on a piece of paper the place for the data on the display.
// Add it to the source code as well
//
// 0123456789012345
// +----------------
// 0 |text, full line
// 1 |Temperature 999C
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
const unsigned char capa_jobbra[] = {
0x00,0x00,0x00,0x00,0x00,0x00,0x0E,0x07, // 11
0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x07, // 12
0x1E,0x0F,0x07,0x03,0x07,0x0F,0x1F,0x15, // 13
0x00,0x00,0x10,0x1C,0x1F,0x1F,0x1F,0x1C, // 14
0x00,0x00,0x00,0x00,0x10,0x1C,0x1E,0x1F, // 15
0x03,0x01,0x01,0x03,0x07,0x0E,0x00,0x00, // 21
0x1F,0x1F,0x1F,0x11,0x00,0x00,0x00,0x00, // 22
0x15,0x16,0x1B,0x1F,0x03,0x01,0x03,0x07, // 23
0x1F,0x1F,0x1D,0x1C,0x1F,0x1C,0x18,0x10, // 24
0x1F,0x1E,0x1C,0x00,0x00,0x00,0x00,0x00, // 25
};
void setup()
{
lcd.init();
lcd.backlight(); // turn on the backlight
lcd.setCursor(0, 1);
lcd.print("Temperature");
lcd.setCursor(15, 1);
lcd.print("C");
}
void loop()
{
lcd.setCursor(0, 0);
switch(random(0,4))
{
// 0123456789012345
case 0: lcd.print(capa_jobbra[0]); break;
case 1: lcd.print("Good morning "); break;
case 2: lcd.print("Good afternoon "); break;
case 3: lcd.print("Good night "); break;
}
lcd.setCursor(12, 1);
lcd.print(" "); // remove previous
int temperature = random(0,150);
lcd.setCursor(12, 1);
lcd.print(temperature); // print new
delay(1000);
}