/*
// http://basicarduinotutorial.blogspot.com/2017/08/project-v-16-setting-set-point-value.html
// Setting Set Point Value Without Keypad
If you have trouble finding the keypad or pin less arduino if added keypad, well here's an easy way to make a replacement keypad with potentiometer. Potensio meter is used to designate the desired set point value and then the setting button is used to determine the set point value. The display is displayed on the LCD.
Hardware Requirement
Potentiometer
Arduino Uno
Push Button
Power supply +5 Volt
*/
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 20, 4);
int adc,nilai, pos;
long setpoint;
const int tombolSET = 8;
void setup(){
pinMode(8,INPUT_PULLUP);
//digitalWrite(8, HIGH);
lcd.init();
lcd.backlight();
lcd.setCursor(0,1);
lcd.print("Seting Nilai");
lcd.setCursor(0,1);
lcd.print("Tanpa Keypad");
delay(2000);
lcd.clear();
lcd.print("Nilai=");
lcd.setCursor(0,1);
lcd.print("SP=");
lcd.blink();
pos=3;
}
void loop(){
adc = analogRead(0);
nilai=map(adc,0,1000,0,9);
lcd.setCursor(6,0);
lcd.print(nilai);
lcd.setCursor(pos,1);
if(digitalRead(tombolSET)==LOW){
setpoint=setpoint*10+nilai;
lcd.setCursor(3,1);
lcd.print(setpoint);
pos++;
delay(200);
}
delay(200);
}