Show double buffering usage
#define OLED_SDA GPIO_NUM_4
#define OLED_SCL GPIO_NUM_15
#define OLED_ADDR 0x3C
#define OLED_RESET GPIO_UNUSED // ie Heltec has GPIO_NUM_16 for reset
void setup()
{
Serial.
begin(115200); delay(500); Serial.write(
"\n\n\n");
I2C.
begin(OLED_SDA, OLED_SCL);
DisplayController.
begin(&I2C, OLED_ADDR, OLED_RESET);
Serial.write("Error, SSD1306 not available!\n");
delay(5000);
}
}
void loop()
{
Canvas cv(&DisplayController);
for (int j = 1; j < 32; ++j) {
cv.setPenWidth(j);
for (int i = 0; i < 360; i += 10) {
cv.clear();
double a = (double) i * M_PI / 180.0;
double w = cv.getWidth() / 2.0;
double h = cv.getHeight() / 2.0;
int x1 = w + cos(a) * w;
int y1 = h + sin(a) * h;
int x2 = w + cos(a + M_PI) * w;
int y2 = h + sin(a + M_PI) * h;
cv.drawLine(x1, y1, x2, y2);
cv.swapBuffers();
delay(60);
}
}
}