-
Notifications
You must be signed in to change notification settings - Fork 0
/
Display.h
125 lines (112 loc) · 5.36 KB
/
Display.h
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
// https://arduino-esp8266.readthedocs.io/en/latest/PROGMEM.html
// change images into byte arrays http://javl.github.io/image2cpp/
// see also example programm ssd1306_64x48_i2c
static const unsigned char PROGMEM robot[] =
{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x3f, 0xff, 0xff,
0xfe, 0x1f, 0xf9, 0xbf, 0xff, 0xff, 0xfc, 0xdf, 0xfc, 0x3f, 0xff, 0xff, 0xfc, 0x1f, 0xfe, 0x7f,
0xff, 0xff, 0xff, 0x3f, 0xfe, 0xe1, 0x87, 0x00, 0x07, 0x7f, 0xfe, 0xcf, 0xff, 0xff, 0xfb, 0x7f,
0xfe, 0x9f, 0xff, 0xff, 0xfd, 0x7f, 0xfe, 0xbf, 0xff, 0xff, 0xfd, 0x7f, 0xfe, 0x3f, 0xff, 0xff,
0xfc, 0x3f, 0xf8, 0x3f, 0xff, 0xff, 0xfc, 0x1f, 0xfb, 0xbf, 0xff, 0xff, 0xfd, 0xef, 0xf3, 0xbe,
0x1f, 0xf8, 0x7d, 0xef, 0xf3, 0xbe, 0xdf, 0xfb, 0x7d, 0xef, 0xf3, 0xbf, 0x1f, 0xf8, 0x7d, 0xef,
0xf3, 0xbf, 0xff, 0xff, 0xfd, 0xef, 0xf3, 0xbf, 0xff, 0xff, 0xfd, 0xef, 0xf3, 0xbf, 0xff, 0xff,
0xfd, 0xef, 0xf9, 0x3f, 0xf3, 0xcf, 0xfc, 0xcf, 0xfb, 0xbf, 0xfc, 0x3f, 0xfc, 0xcf, 0xf3, 0xbf,
0xff, 0xff, 0xfd, 0xef, 0xf7, 0x9f, 0xff, 0xff, 0xfd, 0xef, 0xf7, 0xdf, 0xff, 0xff, 0xf9, 0xf7,
0xe7, 0xe0, 0x00, 0x00, 0x03, 0xff, 0xef, 0xff, 0xf7, 0xef, 0xff, 0xff, 0xef, 0xff, 0xf7, 0xef,
0xff, 0xff, 0xef, 0xff, 0xf7, 0xef, 0xff, 0xf7, 0xef, 0x80, 0x00, 0x00, 0x00, 0xf7, 0xee, 0x7f,
0xff, 0xff, 0xff, 0x77, 0xee, 0xff, 0xff, 0xff, 0xff, 0x37, 0xe6, 0xff, 0xff, 0xff, 0xff, 0x3f,
0xf6, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xf6, 0xff, 0xff, 0xff, 0xff, 0x2f, 0xf6, 0xff, 0xff, 0xff,
0xff, 0x2f, 0xf8, 0xff, 0xff, 0xff, 0xff, 0x0f, 0xf8, 0xff, 0xff, 0xff, 0xff, 0x1f, 0xfc, 0xff,
0xff, 0xff, 0xff, 0x1f, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xfe, 0x7f, 0xff, 0xff, 0xff, 0x7f,
0xff, 0x3f, 0xff, 0xff, 0xfe, 0xff, 0xff, 0x9f, 0xff, 0xff, 0xf9, 0xff, 0xff, 0xcf, 0xff, 0xff,
0xf3, 0xff, 0xff, 0xf3, 0xff, 0xff, 0xc7, 0xff, 0xff, 0xf8, 0xff, 0xff, 0x1f, 0xff, 0xff, 0xfe,
0x1f, 0xf8, 0x7f, 0xff, 0xff, 0xff, 0xe0, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
Adafruit_SSD1306 display(OLED_RESET);
void onDisplay1 (String text)
{
display.setTextColor(WHITE, BLACK);
display.setCursor(1,1);
display.println(" ");
display.setCursor(1,1);
display.println(text);
display.display(); // Update display
delay(10);
}
void onDisplay2 (String text)
{
display.setTextColor(WHITE, BLACK);
display.setCursor(1,12);
display.println(" ");
display.setCursor(1,12);
display.println(text);
display.display(); // Update display
delay(10);
}
void onDisplay3 (String text)
{
display.setTextColor(BLACK,WHITE);
display.setCursor(1,24);
display.println(" ");
display.setCursor(1,24);
display.println(text);
display.display(); // Update display
delay(10);
}
void onDisplay4 (String text)
{
display.setTextColor(BLACK,WHITE);
display.setCursor(1,36);
display.println(" ");
display.setCursor(1,36);
display.println(text);
display.display(); // Update display
delay(10);
}
void drawSplash(void) {
display.drawBitmap(10,1, robot, 48, 48, 1);
display.display();
delay (2000);
display.clearDisplay();
}
void initDisplay()
{
display.begin(SSD1306_SWITCHCAPVCC, 0x3C); // Clear OLED display
display.clearDisplay();
drawSplash ();
display.setTextSize(1.5); // Set OLED text size to small 1.2 => 12 pixel
display.setTextColor(WHITE, BLACK); // Set OLED color to White
onDisplay1("Please");
onDisplay2("choose ..."); // 10 characters
display.fillRect(0,23,64,25, WHITE); // X coordinate, Y coordinate, Width, Height
display.setTextColor(BLACK,WHITE); // inverted text
onDisplay3(" ");
onDisplay4("SySTEM2020");
//display.println(TinyGPSPlus::libraryVersion());
display.display(); // Update display
delay(500); // Pause 1.5 seconds
}
void onDisplayGPS() // Currently not used
{
display.clearDisplay();
display.setTextSize(1);
display.setTextColor(WHITE);
// display.setCursor(0,0);
display.print("LAT: ");
display.println(gps.location.lat(), 2);
display.print("LON: ");
display.println(gps.location.lng(), 2);
display.print("Sats: ");
/*
display.println(gps.satellites.value());
display.print("ALT:");
display.print(gps.altitude.meters(), 1);
display.println("m");
display.println("Time: ");
display.print(gps.time.hour()+2); // GPS time UTC + 2 hrs for Vienna Time
display.print(":");
display.print(gps.time.minute()); // Minutes
display.print(":");
display.println(gps.time.second()); // Seconds
*/
display.display(); // Update display
delay(200);
}