-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathesp32oled.txt
39 lines (31 loc) · 1.03 KB
/
esp32oled.txt
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
//This example uses the https://github.com/adafruit/Adafruit_SSD1306/archive/master.zip and https://github.com/adafruit/Adafruit-GFX-Library/archive/master.zip
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define OLED_RESET 4
Adafruit_SSD1306 display(OLED_RESET);
void setup()
{
Serial.begin(9600);
// by default, we'll generate the high voltage from the 3.3v line internally! (neat!)
display.begin(SSD1306_SWITCHCAPVCC, 0x3C); // initialize with the I2C addr 0x3C (for the 128x32)
// init done
display.clearDisplay();
// text display tests
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(0,0);
display.println("Hello, world!");
display.setTextColor(BLACK, WHITE); // 'inverted' text
display.println(3.141592);
display.setTextSize(2);
display.setTextColor(WHITE);
display.print("0x");
display.println(0xDEADBEEF, HEX);
display.display();
display.clearDisplay();
}
void loop()
{
}