#include<LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 10, 9, 8, 7);
int del = 100;
int vrednost = 0;
void setup() {
lcd.begin(16, 2);
DDRD &= 0b11101111;
PORTD = 0x10;
ADMUX = (1 << REFS0);
ADCSRA = (0 << ADPS2) | (0 << ADPS1) | (1 << ADPS0);
ADCSRA = (1 << ADEN);
}
void loop() {
ADCSRA |= (1 << ADSC);
while (ADCSRA & (1 << ADSC)) {
};
int pot = ADC;
int gumb = PIND & 0x10;
if (gumb != 16){
vrednost ++;
}
delay(del);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Gumb: ");
lcd.setCursor(6, 0);
lcd.print(vrednost);
lcd.setCursor(0, 1);
lcd.print("Pot: ");
lcd.setCursor(5, 1);
lcd.print(pot);
}