Untitled
unknown
plain_text
10 months ago
3.1 kB
23
Indexable
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
#define OLED_RESET -1 // Reset pin # (or -1 if sharing Arduino reset pin)
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
unsigned long startTime;
void setup() {
// Initialize the display
if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
Serial.println(F("SSD1306 allocation failed"));
for(;;);
}
display.clearDisplay();
startTime = millis(); // Start the timer
}
void loop() {
// Run the animation for 5 seconds
if (millis() - startTime < 5000) {
animateComplexIlluminati();
} else{
display.clearDisplay();
display.setTextSize(2);
display.setTextColor(WHITE);
display.setCursor(0, 10);
// Display static text
display.println("WELCOME");
display.display();
delay(2000);
display.clearDisplay();
display.setTextSize(2);
display.setTextColor(WHITE);
display.setCursor(5, 10);
display.println("SHOOFE");
display.setTextSize(1);
display.setCursor(28, 30);
display.println("HAPPY TRACKING");
display.display();
delay(2000);
display.clearDisplay();
display.display();
}}
// Function to animate the complex Illuminati symbol
void animateComplexIlluminati() {
display.clearDisplay();
// Draw a pulsating triangle (Illuminati symbol)
int16_t x1 = 64, y1 = 16;
int16_t x2 = 32, y2 = 48;
int16_t x3 = 96, y3 = 48;
static int pulsateOffset = 0;
static bool pulsateGrow = true;
if (pulsateGrow) {
pulsateOffset++;
if (pulsateOffset > 4) pulsateGrow = false;
} else {
pulsateOffset--;
if (pulsateOffset < -4) pulsateGrow = true;
}
display.drawTriangle(x1, y1 - pulsateOffset, x2, y2 + pulsateOffset, x3, y3 + pulsateOffset, SSD1306_WHITE);
// Animate the eye inside the triangle
static int16_t eyeX = 64;
static bool eyeDir = true;
// Blink the eye
static bool eyeOpen = true;
static unsigned long blinkTime = millis();
if (millis() - blinkTime > 500) { // Blink every 500ms
eyeOpen = !eyeOpen;
blinkTime = millis();
}
if (eyeOpen) {
// Draw the eye
display.drawCircle(eyeX, 32, 6, SSD1306_WHITE); // Outer circle of the eye
display.fillCircle(eyeX, 32, 2, SSD1306_WHITE); // Inner pupil
}
// Move the eye back and forth
if (eyeDir) {
eyeX++;
if (eyeX >= 72) eyeDir = false; // Change direction
} else {
eyeX--;
if (eyeX <= 56) eyeDir = true; // Change direction
}
// Animate rays emanating from the triangle
static int rayAngle = 0;
for (int i = 0; i < 360; i += 45) {
int rayX = 64 + (20 + pulsateOffset) * cos((rayAngle + i) * PI / 180);
int rayY = 32 + (20 + pulsateOffset) * sin((rayAngle + i) * PI / 180);
display.drawLine(64, 32, rayX, rayY, SSD1306_WHITE);
}
rayAngle += 5; // Rotate the rays slowly
display.display(); // Show the current frame
delay(50); // Adjust the speed of the animation
}
Editor is loading...
Leave a Comment