#include <LiquidCrystal.h>
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12,11,10,9,8,7,6,5,4,3,2);
String phrases[] = /* Known phrases */{
"It is certain",
"It is decidedly so",
"Without a doubt",
"Yes, definitely",
"You may rely on it",
"As I see it, yes",
"Most likely",
"Outlook good",
"Yes",
"Signs point to yes",
"Reply hazy try again",
"Ask again later",
"Better not tell you now",
"Cannot predict now",
"Concentrate and ask again",
"Don't count on it",
"My reply is no",
"My sources say no",
"Outlook not so good",
"Very doubtful",
"no but I love you"};
String output;
int numberofphrases = 20; //Number of phrases known, must be the same as, well, the number of phrases known
int inPin = 1;
int val = 0;
void setup()
{
pinMode(inPin, INPUT); // declare pushbutton as input
randomSeed(analogRead(5)); //Seed for random number generation
lcd.begin(16,2); // set up the LCD's number of columns and rows:
lcd.clear();
output = phrases[random(numberofphrases)]; //Chooses phrase
if(output.length()>16){
lcd.setCursor(0,0);
lcd.print(output.substring(0,16));
lcd.setCursor(0,2);
lcd.print(output.substring(16));
}
else{
lcd.print(output); //Displays it
}
}
void loop(){
}