#include <Wire.h>
#include <U8g2lib.h>
#include "OLED_Face_Library.h"
#include "OLED_Eyes.h"
// 屏幕尺寸和引脚定义
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
// OLED 屏幕实例
//U8G2_SSD1306_128X64_NONAME_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE);
U8G2_SSD1306_128X64_NONAME_F_HW_I2C u8g2(U8G2_R0, /* reset=*/U8X8_PIN_NONE, /* clock=*/4, /* data= */ 5);
float distins = 1 / 3;
OLED_Eyes eyes(&u8g2, 1 / 3);
void setup() {
Serial.begin(115200);
eyes.begin();
eyes.drawEyes();
}
void loop() {
//static int eyeX = 0;
//static int eyeY = 0;
//static int directionX = 1;
//static int directionY = 1;
//static unsigned long lastBlinkTime = 0;
//static const unsigned long blinkInterval = 5000; // 每5秒眨眼一次
// 移动眼睛
//eyeX += directionX;
//eyeY += directionY;
//if (eyeX <= 0 || eyeX >= (SCREEN_WIDTH - (eyes.getEyeWidth() * 2 + eyes.getEyeSpacing()))) {
//directionX = -directionX;
//}
//if (eyeY <= 0 || eyeY >= (SCREEN_HEIGHT - eyes.getEyeHeight())) {
//directionY = -directionY;
//}
//eyes.moveEyes(directionX, directionY);
// 眨眼
//unsigned long currentTime = millis();
//if (currentTime - lastBlinkTime > blinkInterval) {
//eyes.blinkEyes();
//lastBlinkTime = currentTime;
//}
//delay(100); // 控制更新频率
}