#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
int rozsah;
bool test1 = true;
bool test2 = true;
void setup() {
lcd.init();
lcd.backlight();
Serial.begin(115200);
pinMode(2,INPUT_PULLUP);
pinMode(0,INPUT_PULLUP);
pinMode(25, INPUT);
}
void loop() {
if(digitalRead(2) == LOW && test1 == true){
rozsah++;
Serial.println(rozsah);
test1 = false;
}
else if(digitalRead(2) == HIGH && test1 == false)
{
test1 = true;
}
if(digitalRead(0) == LOW && test2 == true && rozsah > 1){
rozsah--;
Serial.println(rozsah);
test2 = false;
}
else if(digitalRead(0) == HIGH && test2 == false)
{
test2 = true;
}
lcd.setCursor(0,1);
lcd.print("0 - ");
lcd.setCursor(4,1);
lcd.print(rozsah);
lcd.print(" ");
lcd.setCursor(0,0);
int a = analogRead(25);
a = map(a,0,4095,0,rozsah);
lcd.println(a);
}