/* A positive message is shown every second on an LCD
https://github.com/ostad-ai/Arduino-Tutorial
*/
#include <LiquidCrystal.h>
#define SIZE(x) (sizeof(x)/sizeof(x[0]))
// we use 4-bit mode for lcd: means only four bits are used for data
// rs is Register Select pin, and en is Enable pin
const int rs = 12, en = 11, d4 = 10, d5 = 9, d6 = 8, d7 = 7;
LiquidCrystal lcd(rs,en,d4,d5,d6,d7);
char *msgs[]={"Hello fighter", "Be happy","Move forward",
"Don't give up", "Keep going","You can do it"};
char hw[]="Positive Message";
int msgs_size;
void setup() {
// put your setup code here, to run once:
// lcd.begin(number of columns, number of rows)
lcd.begin(16,2);
lcd.print(hw);
msgs_size=SIZE(msgs);
}
void loop() {
// put your main code here, to run repeatedly:
int index=random(msgs_size);
//setCursor(column number, row number)
lcd.setCursor(0,1);
lcd.print(msgs[index]);
delay(1000);
lcd.clear();
lcd.print(hw);
}