#include <Wire.h> #include <Adafruit_SSD1306.h> #include <Adafruit_GFX.h> // OLED display TWI address #define OLED_ADDR 0x3C #define SCREEN_WIDTH 128 // OLED display width, in pixels #define SCREEN_HEIGHT 32 // OLED display height, in pixels // Declaration for an SSD1306 display connected to I2C (SDA, SCL pins) #define OLED_RESET 4 // Reset pin # (or -1 if sharing Arduino reset pin) Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET); void setup() { Serial.begin(9600); // initialize and clear display display.begin(SSD1306_SWITCHCAPVCC, OLED_ADDR); display.clearDisplay(); display.display(); } void loop() { // display a first circle display.drawCircle(64, 16, 14, WHITE); delay(50); // // display a second smallest circle display.drawCircle(64, 16, 8, WHITE); delay(50); // // display a third smallest circle display.drawCircle(64, 16, 4, WHITE); delay(50); // Pause // display a line display.drawLine(64, 16, 80, 16, WHITE); delay(50); // Pause display.display(); display.clearDisplay(); delay(1000); |