#include <LiquidCrystal_PCF8574.h>
#include <Wire.h>
#include <time.h>
//initialize the liquid crystal library
//the first parameter is the address
LiquidCrystal_PCF8574 lcd(0x27);
bool runComplete = false;
void setup() {
//initialize lcd screen
lcd.begin(16, 2);
// turn on the backlight
lcd.setBacklight(255);
randomSeed(analogRead(0));
}
void loop() {
// put your main code here, to run repeatedly:
if (!runComplete) {
int num = random(0, 101);
lcd.setCursor(0,0);
lcd.print(num);
lcd.setCursor(0,1);
bool prime = true;
for(int i = 2; i < num -1; i++ ) {
if(num % i == 0) {
lcd.print("NOT PRIME");
prime = false;
break;
}
}
if(prime) {
if(num != 0) {
lcd.print("PRIME ");
runComplete = true;
}
}
delay(200);
}
}