#include <LiquidCrystal.h>
LiquidCrystal lcd(12,11,10,9,8,7); // RS,E...D7
int button = 6;
int num = 0;
void setup() {
lcd.begin(16,2); // 16 stolpcev in 2 vrstici
pinMode(A0, INPUT);
pinMode(button, INPUT_PULLUP);
}
void loop() {
int pot = map(analogRead(A0), 0, 1023, 1, 10);
if(digitalRead(button) == LOW){
num = num + pot;
numPrint(num);
while(digitalRead(button) == LOW) delay(100);
}
lcd.clear();
numPrint(num);
potPrint(pot);
delay(50);
}
void numPrint(int y){
lcd.setCursor(0,0);
lcd.print(y);
}
void potPrint(int y){
lcd.setCursor(0,1);
lcd.print(y);
}