-
Notifications
You must be signed in to change notification settings - Fork 1
/
lcddisplay.cpp
87 lines (75 loc) · 2.32 KB
/
lcddisplay.cpp
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#include "lcddisplay.h"
#include "Arduino.h"
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
void lcddisplay() {
extern int seatStatus;
extern LiquidCrystal_I2C lcd;
extern int timeRemained;
extern int action;
//action=1, display avaliable and green light.
//action=2, display temporarily out and blue light.
//action=3, display occupied and red.
//action=4, display invalid and flash red light.
//action=5, display "Right ID card" when be back.
//action=6, display "Card is registered."
//action=7, display "NOT Right ID card"
//action=8, display the updating the time! USED DURING THE SEAT STATUS!!!
if (action == 4) {
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("[Error]");
lcd.setCursor(0, 1);
lcd.print("Invalid ID card");
} else if (action == 1) {
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("[Available]");
lcd.setCursor(0, 1);
lcd.print("Insert ID card");
} else if (action == 3) {
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("[Occupied]");
lcd.setCursor(0, 1);
lcd.print("Report if empty");
} else if (action == 2) { // the instant of "away" change!
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("[Away]");
lcd.setCursor(0, 1);
//====Original action 2====//
//int remainedSec = timeRemained % 60;
//int remainedMin = (timeRemained - remainedSec) / 60;
//lcd.print("Reset in");
lcd.print("Reset in 0:10");
//====Original action 2====//
//lcd.print(remainedMin);
//lcd.print(":");
//lcd.print(remainedSec-remainedSec%10); // UI fix by fruit
//lcd.print(remainedSec%10); // UI fix by fruit
} else if (action == 5) {
lcd.setCursor(0, 0);
lcd.print("Right ID card");
lcd.setCursor(0, 1);
lcd.print(" ");
} else if (action == 6) {
lcd.setCursor(0, 0);
lcd.print("Card registered.");
lcd.setCursor(0, 1);
lcd.print(" ");
} else if (action == 7) {
lcd.setCursor(0, 0);
lcd.print("Wrong ID card");
lcd.setCursor(0, 1);
lcd.print(" ");
} else if (action == 8) {
lcd.setCursor(9, 1);
int remainedSec = timeRemained % 60;
int remainedMin = (timeRemained - remainedSec) / 60;
lcd.print(remainedMin);
lcd.print(":");
lcd.print((remainedSec-remainedSec%10)/10);
lcd.print(remainedSec%10);
}
}