#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define OLED_RESET -1
#define SCREEN_ADDRESS 0x3C
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
Adafruit_SSD1306 oled(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
void setup() {
Serial.begin(9600);
// Initialize OLED display with I2C address 0x3C
if (!oled.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) {
Serial.println(F("failed to start SSD1306 OLED"));
while (1);
}
// Clear display
oled.clearDisplay();
// Set text size, color, and cursor position
oled.setTextSize(1);
oled.setTextColor(WHITE);
// Draw the line patterns
int xStart = 10; // Starting x coordinate for the lines
int yStart = 20; // y coordinate for the lines
int lineLength = 20; // Length of each segment
// Draw vertical lines
oled.drawLine(xStart, yStart, xStart, yStart + 30, WHITE); // First vertical line
xStart += lineLength + 10; // Move x coordinate to the right for the next line
oled.drawLine(xStart, yStart, xStart, yStart + 30, WHITE); // Second vertical line
xStart += lineLength + 10; // Move x coordinate to the right for the next line
oled.drawLine(xStart, yStart, xStart, yStart + 30, WHITE); // Third vertical line
xStart += lineLength + 10; // Move x coordinate to the right for the next line
oled.drawLine(xStart, yStart, xStart, yStart + 30, WHITE); // Fourth vertical line
// Draw horizontal lines
int yOffset = 10; // Offset for horizontal lines
oled.drawLine(10, yStart + 15 - yOffset, 10 + lineLength, yStart + 15 - yOffset, WHITE); // First horizontal line
oled.drawLine(10 + lineLength + 10, yStart + 15 - yOffset, 10 + 2 * (lineLength + 10), yStart + 15 - yOffset, WHITE); // Second horizontal line
oled.drawLine(10 + 2 * (lineLength + 10) + 10, yStart + 15 - yOffset, 10 + 3 * (lineLength + 10), yStart + 15 - yOffset, WHITE); // Third horizontal line
// Update display with all changes
oled.display();
}
void loop() {
// Put your main code here, to run repeatedly:
}