#include <LiquidCrystal_I2C.h>
#include <Wire.h>
LiquidCrystal_I2C lcd(32, 16, 2); // set the LCD address to 0x3F for a 16 chars and 2 line display
int PB = 2;
void scrollMessage(int row, String message, int delayTime, int totalColumns)
{
for (int i = 0; i < totalColumns; i++)
{
message = " " + message;
}
message = message + " ";
for (int position = 0; position < message.length(); position++)
{
lcd.setCursor(0, row);
lcd.print(message.substring(position, position + totalColumns));
delay(delayTime);
}
}
void setup()
{
pinMode(PB, INPUT_PULLUP);
lcd.init();
lcd.clear();
lcd.backlight();
}
void loop()
{
while (digitalRead(PB) == 1)
{
lcd.setCursor(1, 0);
lcd.print("Hello World");
delay(500);
scrollMessage(1, "Welcome!", 250, 16);
}
if (digitalRead(PB) == 0)
{
lcd.clear();
lcd.setCursor(1, 0);
lcd.print("Let's begin!");
}
}
uno:A5.2
uno:A4.2
uno:AREF
uno:GND.1
uno:13
uno:12
uno:11
uno:10
uno:9
uno:8
uno:7
uno:6
uno:5
uno:4
uno:3
uno:2
uno:1
uno:0
uno:IOREF
uno:RESET
uno:3.3V
uno:5V
uno:GND.2
uno:GND.3
uno:VIN
uno:A0
uno:A1
uno:A2
uno:A3
uno:A4
uno:A5
lcd1:GND
lcd1:VCC
lcd1:SDA
lcd1:SCL
btn1:1.l
btn1:2.l
btn1:1.r
btn1:2.r