-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOLED_Graphic.cpp
More file actions
51 lines (45 loc) · 1004 Bytes
/
OLED_Graphic.cpp
File metadata and controls
51 lines (45 loc) · 1004 Bytes
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
#include <Arduino.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define OLED_RESET -1
Adafruit_SSD1306 OLED(OLED_RESET);
#if (SSD1306_LCDHEIGHT != 64)
#error("Height incorrect, please fix Adafruit_SSD1306.h!");
#endif
void setup() {
OLED.begin(SSD1306_SWITCHCAPVCC, 0x3C);
}
void loop(){
OLED.clearDisplay();
OLED.setTextColor(WHITE,BLACK);
int x = 0;
int y = 0;
int w = 127;
int h = 63;
for(int i=0; i<5;i++){
OLED.drawRect(i*5,i*5,128-i*10,64-i*10,WHITE);
delay(250);
OLED.display();
}
OLED.clearDisplay();
for(int i=0; i<5;i++){
OLED.drawRect(i*5,i*5,128-i*10,64-i*10,WHITE);
delay(250);
OLED.display();
OLED.clearDisplay();
}
OLED.clearDisplay();
for(int i=0; i<5;i++){
OLED.drawCircle(64,32,31-i*5,WHITE);
delay(250);
OLED.display();
}
OLED.clearDisplay();
for(int i=0; i<5;i++){
OLED.drawCircle(64,32,31-i*5,WHITE);
delay(250);
OLED.display();
OLED.clearDisplay();
}
}