#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include "numbers.h"
#define WIDTH 128 // y
#define HEIGHT 64 // x // use 32 for 128x32
#define STARTy 32 // horizontal, right column is 0
#define STARTx 0 // vertical, top row is 0
#define OLED_RESET -1
#define OLED_I2C 0x3C
Adafruit_SSD1306 display(WIDTH, HEIGHT, &Wire, OLED_RESET);
unsigned long timer, timeout = 1000; // one second wait
void setup() {
Serial.begin(9600);
display.begin(SSD1306_SWITCHCAPVCC, OLED_I2C);
display.clearDisplay(); // Clear the display buffer.
}
void loop() {
// if (millis() - timer > timeout) { // one second wait
// timer = millis();
for (int i = 0; i < 10; i++) {
switch (i) {
case 0: zro(); break;
case 1: one(); break;
case 2: two(); break;
case 3: tre(); break;
case 4: fur(); break;
case 5: fiv(); break;
case 6: six(); break;
case 7: svn(); break;
case 8: egt(); break;
case 9: nin(); break;
}
display.display();
delay(1000);
display.clearDisplay(); // Clear the display buffer.
}
}
void zro() {
display.drawBitmap( // place bitmap in screen buffer
STARTx, // start x of bitmap
STARTy, // start y of bitmap
epd_bitmap_0, // title of bitmap
WIDTH, // width of display
HEIGHT, // height of display
WHITE); // color of pixels (WHITE or BLACK, 1 or 0)
}
void one() {
display.drawBitmap(STARTx, STARTy, epd_bitmap_1, WIDTH, HEIGHT, WHITE);
}
void two() {
display.drawBitmap(STARTx, STARTy, epd_bitmap_2, WIDTH, HEIGHT, WHITE);
}
void tre() {
display.drawBitmap(STARTx, STARTy, epd_bitmap_3, WIDTH, HEIGHT, WHITE);
}
void fur() {
display.drawBitmap(STARTx, STARTy, epd_bitmap_4, WIDTH, HEIGHT, WHITE);
}
void fiv() {
display.drawBitmap(STARTx, STARTy, epd_bitmap_5, WIDTH, HEIGHT, WHITE);
}
void six() {
display.drawBitmap(STARTx, STARTy, epd_bitmap_6, WIDTH, HEIGHT, WHITE);
}
void svn() {
display.drawBitmap(STARTx, STARTy, epd_bitmap_7, WIDTH, HEIGHT, WHITE);
}
void egt() {
display.drawBitmap(STARTx, STARTy, epd_bitmap_8, WIDTH, HEIGHT, WHITE);
}
void nin() {
display.drawBitmap(STARTx, STARTy, epd_bitmap_9, WIDTH, HEIGHT, WHITE);
}