-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlcd.ino
50 lines (37 loc) · 898 Bytes
/
lcd.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
#include <LiquidCrystal.h>
#define LCD_LENGTH 16
#define LCD_HEIGHT 2
LiquidCrystal lcd(7, 8, 9, 10, 11 , 12);
void setupLCD() {
lcd.begin(LCD_LENGTH, LCD_HEIGHT);
printOutLn("Covfefe", 0);
printOutLn("by @harvzor", 1);
delay(3000);
printOutLn("Drinks Drunk", 0);
printOutLn("by @harvzor", 1);
delay(3000);
}
void printOut(String str) {
lcd.clear();
if (str.length() > LCD_LENGTH) {
printOutLn(str.substring(0, LCD_LENGTH), 0);
printOutLn(str.substring(LCD_LENGTH), 1);
} else {
printOutLn(str);
}
}
void printOutLn(String str) {
lcd.clear();
printOutLn(str, 1);
}
void printOutLn(String str, int row) {
lcd.setCursor(0, row);
lcd.write(str.c_str());
Serial.println(str);
}
void printOutLn(String str, int row, bool clear) {
if (clear) {
lcd.clear();
}
printOutLn(str, row);
}