#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include "animations.h"
#define SCREEN_I2C_ADDR 0x3C // or 0x3C
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
#define OLED_RST_PIN -1 // Reset pin (-1 if not available)
Adafruit_SSD1306 display(128, 64, &Wire, OLED_RST_PIN);
void setup() {
display.begin(SSD1306_SWITCHCAPVCC, SCREEN_I2C_ADDR);
display.clearDisplay(); // clear display
display.setTextSize(1); // set text size
display.setTextColor(WHITE); // set text color
Serial.println(0);
}
int frame = 0;
int emotionloop = 0;
void loop() {
display.clearDisplay();
frame = (frame + 1) % FRAME_COUNT;
Serial.println(frame);
if (frame % 28 == 27){
emotionloop = (emotionloop + 1) % 7;
}
Serial.println(emotionloop);
switch(emotionloop % 7){
case 1:
display.drawBitmap(32, 0, sad[frame], FRAME_WIDTH, FRAME_HEIGHT, 1);
break;
case 2:
display.drawBitmap(32, 0, sigh[frame], FRAME_WIDTH, FRAME_HEIGHT, 1);
break;
case 3:
display.drawBitmap(32, 0, happy[frame], FRAME_WIDTH, FRAME_HEIGHT, 1);
break;
case 4:
display.drawBitmap(32, 0, exalted[frame], FRAME_WIDTH, FRAME_HEIGHT, 1);
break;
case 5:
display.drawBitmap(32, 0, Hot[frame], FRAME_WIDTH, FRAME_HEIGHT, 1);
break;
case 6:
display.drawBitmap(32, 0, Cold[frame], FRAME_WIDTH, FRAME_HEIGHT, 1);
break;
default:
display.drawBitmap(32, 0, Normal[frame], FRAME_WIDTH, FRAME_HEIGHT, 1);
// default is optional
break;
}
display.display();
}