-
Notifications
You must be signed in to change notification settings - Fork 0
/
oled_disp.ino
38 lines (31 loc) · 814 Bytes
/
oled_disp.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
#include <Wire.h>
#include <Adafruit_SSD1306.h>
#include <Adafruit_GFX.h>
// OLED display TWI address
#define OLED_ADDR 0x3C
Adafruit_SSD1306 display(-1);
#if (SSD1306_LCDHEIGHT != 64)
#error("Height incorrect, please fix Adafruit_SSD1306.h!");
#endif
void setup() {
// initialize and clear display
display.begin(SSD1306_SWITCHCAPVCC, OLED_ADDR);
display.clearDisplay();
}
void loop() {
// put your main code here, to run repeatedly:
// display a line of text
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(27,30);
display.print("Hello");
display.display();
display.clearDisplay();
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(27,30);
display.print("world!");
display.display();
display.clearDisplay();
delay(2000);
}