#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
void setup() {
lcd.init();
lcd.backlight();
DDRD = 0x00;
PORTD = 0xFF;
}
int x = 0;
void loop() {
int minVal = 0;
int maxVal = 5;
int randomNumber1 = random(minVal, maxVal);
int randomNumber2 = random(minVal, maxVal);
int a = randomNumber1;
int b = randomNumber2;
if(PINB &= (1<<5) != 0) {
if(a == b){
x++;
}else if( a != b){
x--;
}
}
if(PINB &= (1<<3) == 0) {
x = 0;
}
if(x < 0 ){
x = 0;
}
lcd.setCursor(0,0);
lcd.println("c1");
lcd.print(a);
lcd.setCursor(8,0);
lcd.println("c2");
lcd.print(b);
delay(225);
lcd.setCursor(0,1);
lcd.println("BODOV");
lcd.print(x);
if(x < 5){
DDRB = 0x00;
PINB = 0xFF;
}else if(x > 5){
DDRC = 0x00;
PINC = 0xFF;
}
}