-
Notifications
You must be signed in to change notification settings - Fork 2
/
ddhere.ino
59 lines (39 loc) · 1.49 KB
/
ddhere.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
#include "ssdumbdisplay.h"
#define BLUETOOTH
#ifdef BLUETOOTH
// assume HC-06 connected, to pin 2 and 3
DumbDisplay dumbdisplay(new DDSoftwareSerialIO(new SoftwareSerial(2, 3), 115200, true));
#else
// otherwise, can use DumbDisplayWifiBridge -- https://www.youtube.com/watch?v=0UhRmXXBQi8
DumbDisplay dumbdisplay(new DDInputOutput(115200));
#endif
GraphicalDDLayer *graphical;
LcdDDLayer *button;
GpsServiceDDTunnel *gpsTunnel;
void setup() {
// create a graphical LCD layer for showing the current date-time got
graphical = dumbdisplay.createGraphicalLayer(200, 30);
// create a LCD layer, as a button, to get click feedback
button = dumbdisplay.createLcdLayer(12, 1);
button->writeCenteredLine("check HERE");
button->enableFeedback("fl");
// auto pin the two layers created above vertically
dumbdisplay.configAutoPin(DD_AP_VERT);
// create a GPS service tunnel
gpsTunnel = dumbdisplay.createGpsServiceTunnel();
}
void loop() {
if (button->getFeedback() != NULL) {
// button clicked ==> request GPS location
gpsTunnel->reconnectForLocation();
}
DDLocation location;
if (gpsTunnel->readLocation(location)) {
// got GPS location feedback ==> display the location
graphical->clear();
graphical->setCursor(0, 0);
graphical->println("LOC:");
graphical->println("LAT:" + String(location.latitude, 4) + " / LONG:" + String(location.longitude, 4));
}
DDYield(); // give DumbDisplay a chance to do it's work
}