// ← back to all

eyes_sleepy

// eyes_sleepy · by 0x1306 · 6 frames · 125ms · robot_eyes
// views · runs
// preview
frame_00 / 06// 125ms per frame
// space: play/pause · ←→: step frames
12345678910111213141516171819202122232425262728293031323334353637
#include <Wire.h> #include <Adafruit_GFX.h> #include <Adafruit_SSD1306.h> // 0x1306.dev · animation: eyes_sleepy · robot_eyes · 125ms #define SCREEN_WIDTH 128 #define SCREEN_HEIGHT 64 #define OLED_RESET -1 Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET); void drawEyes(int lx, int ly, int lw, int lh, int lr, int rx, int ry, int rw, int rh, int rr) { display.fillRoundRect(lx - lw/2, ly - lh/2, lw, lh, lr, WHITE); display.fillRoundRect(rx - rw/2, ry - rh/2, rw, rh, rr, WHITE); } void drawFrame(int frame) { display.clearDisplay(); int heights[] = {28, 22, 14, 8, 14, 22}; int h = heights[frame % 6]; drawEyes(32, 32 + (28-h)/2, 38, h, 4, 96, 32 + (28-h)/2, 38, h, 4); display.fillRect(32-19, 32-14, 38, 10, BLACK); display.fillRect(96-19, 32-14, 38, 10, BLACK); display.display(); } void setup() { Wire.begin(21, 22); display.begin(SSD1306_SWITCHCAPVCC, 0x3C); } void loop() { for (int i = 0; i < 6; i++) { drawFrame(i); delay(125); } }
// share
// embed
// paste into any html · 320×200 · transparent click opens detail page