-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathdisplay.cpp
47 lines (39 loc) · 1.16 KB
/
display.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
#include <Adafruit_SSD1306.h>
#include "display.h"
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
#define OLED_RESET -1 // Reset pin # (or -1 if sharing Arduino reset pin)
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
void displaySetup()
{
Serial.print("Starting Display ... ");
display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
Serial.println("Done");
display.clearDisplay();
display.setTextSize(2); // Draw 2X-scale text
display.setTextColor(SSD1306_WHITE);
display.clearDisplay();
display.setCursor(0, 0);
display.print(APPNAME);
display.display();
}
void displayLoop()
{
// static unsigned long msTick = millis();
// if (millis() - msTick >= 500) // 500ms refresh rate
//{
// msTick = millis();
display.clearDisplay();
display.setCursor(0, 0);
display.print("Y: ");
display.println(yaw);
display.print("P: ");
display.println(pitch);
display.print("R: ");
display.println(roll);
display.print("T: ");
display.println(temperature);
display.display();
//}
}