#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,16,2);
char Red='R', Blue='B', Green ='G';
int button=2;
int buttonState;
int randNum;
void setup(){
lcd.begin(16,2);
lcd.backlight();
lcd.init();
randomSeed(analogRead(0));
}
void loop(){
buttonState = digitalRead(button);
if(buttonState == 1)
{
delay(200);
lcd.clear();
delay(200);
randNum = random(1,7);
switch(randNum)
{
case 1:
Red = 'R';
break;
case 2:
Red = 'G';
break;
case 3:
Red = 'B';
break;
case 4:
Red = 'Y';
break;
case 5:
Red = 'W';
break;
case 6:
Red = 'O';
break;
}
lcd.setCursor(0,0);
lcd.print("KULAY:" );
lcd.setCursor(6,0);
lcd.print(Red);
delay(2000);
lcd.clear();
}
else
{
lcd.setCursor(3,0);
lcd . print ("MARVIN" ) ;
lcd.setCursor(0,1);
lcd.print ("MAGALLANES");
lcd.scrollDisplayRight();
delay(100);
}
}