#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <EEPROM.h>
LiquidCrystal_I2C lcd(0x27,20,4);
struct varEEPROM {
uint8_t SET = 15;
}; varEEPROM EE;
typedef String str;
int SET;
const int bok = 15;
const int bmen = 2;
const int bup = 17;
const int brg = 18;
const int bdw = 5;
const int blf = 16;
bool setmode = 0, changeValue = 0;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
lcd.init();
lcd.backlight();
pinMode(bok, INPUT_PULLUP);
pinMode(bmen, INPUT_PULLUP);
pinMode(bup, INPUT_PULLUP);
pinMode(brg, INPUT_PULLUP);
pinMode(bdw, INPUT_PULLUP);
pinMode(blf, INPUT_PULLUP);
cursor(1,1); print(" WELCOME");
cursor(1,2); print("PT.UNIPACK PLASINDO");
delay(2000);
lcd.clear();
}
void loop() {
// put your main code here, to run repeatedly:
cursor(0,0); print("Suhu = ");print("15 ");print("C");cursor(12,0); print("Set=");print(EE.SET);print(" C");
cursor(0,1); print("Gas = ");print("80 ");print("C");cursor(12,1); print("COM = ");print("ON");
cursor(0,3); print("[SETPOIN]");print(" [MENU]");
//lcd.clear();
if (digitalRead(bok)==LOW ){
delay(100);
while (digitalRead(bok)==LOW) {}
setmode = 1;
} else if (digitalRead(bmen)==LOW ){
delay(100);
while (digitalRead(bmen)==LOW) {}
setmode = 0;
}
if(setmode){
lcd.clear();
cursor(1,1);print("SETPOIN = ");print(EE.SET);
if(digitalRead(bup) == LOW){
changeValue = 1;
EE.SET ++ ;
}
if(digitalRead(bdw) == LOW){
changeValue = 1;
EE.SET -- ;
}
}
if (changeValue == 1){
changeValue = 0;
EEPROM.put(0,EE);
delay(2);
}
}
void cursor(int x, int y){
lcd.setCursor(x, y);
}
void print(String str){
lcd.print(str);
}
void print(int data){
lcd.print(data);
}