-
Notifications
You must be signed in to change notification settings - Fork 0
/
lcd_test.ino.old
68 lines (61 loc) · 1.63 KB
/
lcd_test.ino.old
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
/***************************************************
A fork of Adafruit LiquidCrystal library that support
i2c / SPI character LCD backpack.
****************************************************/
#include "Adafruit_LiquidCrystal/Adafruit_LiquidCrystal.h"
// TO connect via I2C. Data pin is D0, Clock is D1
// By default, no jumpers are soldered, giving an address of 0.
LiquidCrystal lcd(0);
void setup() {
// set up the LCD's number of rows and columns:
lcd.begin(20, 4);
//lcd.setBacklight(HIGH);
}
void loop() {
// set the cursor to column 0, line 1
// (note: line 1 is the second row, since counting begins with 0):
lcd.setCursor(0, 0);
lcd.print(getLine(1,1,"123.4", "123.4"));
//lcd.print(">Pit: 123.3 / 180.0");
lcd.setCursor(0, 1);
lcd.print(" M 1: 123.3 / 180.0");
lcd.setCursor(0, 2);
lcd.print(" M 2: 123.3 / 180.0");
lcd.setCursor(0, 3);
lcd.print(" Fan: 123.3 (100%)");
//lcd.print(millis()/1000);
lcd.setBacklight(HIGH);
delay(500);
lcd.setBacklight(LOW);
delay(500);
}
String getLine(int row, int currentSetting, String v1, String v2) {
String s;
String t;
String result;
if (row == currentSetting) {
s=">";
}
else
{
s=" ";
}
switch (row) {
case 1:
t="Pit";
break;
case 2:
t="Mt1";
break;
case 3:
t="Mt2";
break;
}
result = s += t;
result = result += ": ";
result = result += v1;
result = result += " / ";
result = result += v2;
return result;
//return (s += t += ": " += v1 += v2);
}