-
Notifications
You must be signed in to change notification settings - Fork 3
/
HW-364A_V1.ino
45 lines (35 loc) · 1.05 KB
/
HW-364A_V1.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
#include <Adafruit_SSD1306.h>
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
#define OLED_RESET -1 // Reset pin # (or -1 if sharing Arduino reset pin)
#define SCREEN_ADDRESS 0x3C // If not work please scan the bus
#define OLED_SDA 14 // D6
#define OLED_SCL 12 // D5
Adafruit_SSD1306 *display;
int c = 0;
void handle_oled(int c) {
display->clearDisplay();
display->setTextSize(1);
display->setTextColor(SSD1306_WHITE);
display->setCursor(0, 0);
display->println("Display is working!");
display->println("");
display->println("");
display->println("Have fun with it");
display->println("");
display->println("");
display->print("Uptime: ");
display->print(c);
display->println("s");
display->display();
}
void setup() {
display = new Adafruit_SSD1306(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
Wire.begin(OLED_SDA, OLED_SCL);
display->begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS);
}
void loop() {
handle_oled(c);
c++;
delay(1000);
}