// Define Screen Measures
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
//Include Libraries
#include <Wire.h> // Bus I2C Library
#include <Adafruit_GFX.h> // Graphic display Library
#include <Adafruit_SSD1306.h> // SSD1306 Library
#define OLED_RESET 4
Adafruit_SSD1306 oled(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET); // Create Object
// Variables of Triangule
int x = SCREEN_WIDTH / 2;
int y = 10;
int x2 = 10;
int y2 = SCREEN_HEIGHT - 10;
int x3 = SCREEN_WIDTH - 10;
int y3 = SCREEN_HEIGHT - 10;
// Variables of Circle
int centerX = SCREEN_WIDTH / 2;
int centerY = SCREEN_HEIGHT / 2;
void setup() {
Wire.begin(); // Start bus I2C
oled.begin(SSD1306_SWITCHCAPVCC, 0x3C); // Start display with 0x3C adresss
}
void loop() {
oled.clearDisplay();
// Fill Square
oled.fillRect(40, 5, 50, 50, WHITE);
oled.display();
delay(500);
// Color Text
oled.clearDisplay(); // Clear Display
oled.setTextSize(2); // Set Size
oled.setTextColor(WHITE); // Seth Color
oled.setCursor(30,20); // Coordinates
oled.println("= red"); // Text
oled.display();
delay(1000);
oled.clearDisplay();
// Fill Circle
oled.fillCircle(centerX, centerY, 25, WHITE);
oled.display();
delay(500);
// Color Text
oled.clearDisplay();
oled.setTextSize(2);
oled.setTextColor(WHITE);
oled.setCursor(25,20);
oled.println("= blue");
oled.display();
delay(1000);
oled.clearDisplay();
// Fill Triangle
oled.fillTriangle(x, y, x2, y2, x3, y3, WHITE);
oled.display();
delay(500);
// Color Text
oled.clearDisplay();
oled.setTextSize(2);
oled.setTextColor(WHITE);
oled.setCursor(15,20);
oled.println("= yellow");
oled.display();
delay(1000);
// Text
oled.clearDisplay();
oled.setTextColor(WHITE);
oled.setTextSize(2);
oled.setCursor(30, 14);
oled.print("Color");
oled.setTextSize(1.5);
oled.setCursor(30, 30);
oled.print("Combination");
oled.display();
delay(1000);
// Square + Circle
oled.clearDisplay();
// Square
oled.fillRect(40, 5, 50, 50, WHITE);
oled.display();
delay(500);
oled.clearDisplay();
oled.setTextSize(3);
oled.setTextColor(WHITE);
oled.setCursor(60,20);
oled.println("+");
oled.display();
delay(500);
oled.clearDisplay();
// Circle
oled.fillCircle(centerX, centerY, 25, WHITE);
oled.display();
delay(500);
oled.clearDisplay();
oled.setTextSize(2);
oled.setTextColor(WHITE);
oled.setCursor(15,20);
oled.println("= purple");
oled.display();
delay(1000);
// Square + Triangule
oled.clearDisplay();
// Square
oled.fillRect(40, 5, 50, 50, WHITE);
oled.display();
delay(500);
oled.clearDisplay();
oled.setTextSize(3);
oled.setTextColor(WHITE);
oled.setCursor(60,20);
oled.println("+");
oled.display();
delay(500);
oled.clearDisplay();
// Triangule
oled.fillTriangle(x, y, x2, y2, x3, y3, WHITE);
oled.display();
delay(500);
oled.clearDisplay();
oled.setTextSize(2);
oled.setTextColor(WHITE);
oled.setCursor(15,20);
oled.println("= orange");
oled.display();
delay(1000);
// Circle + Triangule
oled.clearDisplay();
// Circle
oled.fillCircle(centerX, centerY, 25, WHITE);
oled.display();
delay(500);
oled.clearDisplay();
oled.setTextSize(3);
oled.setTextColor(WHITE);
oled.setCursor(60,20);
oled.println("+");
oled.display();
delay(500);
oled.clearDisplay();
// Triangule
oled.fillTriangle(x, y, x2, y2, x3, y3, WHITE);
oled.display();
delay(500);
oled.clearDisplay();
oled.setTextSize(2);
oled.setTextColor(WHITE);
oled.setCursor(18,20);
oled.println("= green");
oled.display();
delay(1000);
}