-
Notifications
You must be signed in to change notification settings - Fork 0
/
calonDispenser.ino
68 lines (61 loc) · 1.46 KB
/
calonDispenser.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,2,1,0,4,5,6,7,3, POSITIVE);
int s1 = 4;
int s2 = 5;
int outH = 6;
int outK = 7;
int outM = 8;
//int liquid_level = 0;
void setup() {
// put your setup code here, to run once:
pinMode (s1, INPUT);
pinMode (s2, INPUT);
pinMode (outM, OUTPUT);
pinMode (outK, OUTPUT);
pinMode (outH, OUTPUT);
lcd.begin (16,2);
}
void loop() {
// put your main code here, to run repeatedly:
int Liquid_level1 = 1;
int Liquid_level2 = 0;
lcd.setBacklight(HIGH);
lcd.setCursor(0,0);
lcd.print("STATUS GALON");
Liquid_level1 = digitalRead(4);
Liquid_level2 = digitalRead(5);
if ((Liquid_level1 == 1) && (Liquid_level2 == 1)){
digitalWrite (outH, HIGH);
digitalWrite (outK, LOW);
digitalWrite (outM, LOW);
lcd.setCursor(0,1);
lcd.print("PENUH");
delay(1000);
lcd.setBacklight(HIGH);
delay(1000);
}
delay(100);
if ((Liquid_level1 == 0) && (Liquid_level2 == 1)){
digitalWrite (outH, LOW);
digitalWrite (outK, HIGH);
digitalWrite (outM, LOW);
lcd.setCursor(0,1);
lcd.print("SEDANG");
delay(1000);
lcd.setBacklight(HIGH);
delay(1000);
}
delay(100);
if ((Liquid_level1 == 0) && (Liquid_level2 == 0)){
digitalWrite (outH, LOW);
digitalWrite (outK, LOW);
digitalWrite (outM, HIGH);
lcd.setCursor(0,1);
lcd.print("KOSONG");
delay(1000);
lcd.setBacklight(HIGH);
delay(1000);
}
delay(100);
}