something like this (untested)
#include "Adafruit_SSD1306/Adafruit_GFX.h"
#include "Adafruit_SSD1306/Adafruit_SSD1306.h"
/* Uncomment this block to use hardware SPI
// If using software SPI (the default case):
#define OLED_MOSI D0
#define OLED_CLK D1
#define OLED_DC D2
#define OLED_CS D3
#define OLED_RESET D4
Adafruit_SSD1306 display(OLED_MOSI, OLED_CLK, OLED_DC, OLED_RESET, OLED_CS);
*/
// use hardware SPI
#define OLED_DC D3
#define OLED_CS D4
#define OLED_RESET D5
Adafruit_SSD1306 display(OLED_DC, OLED_RESET, OLED_CS);
#define NUMFLAKES 10
#define XPOS 0
#define YPOS 1
#define DELTAY 2
#define LOGO16_GLCD_HEIGHT 16
#define LOGO16_GLCD_WIDTH 16
static const unsigned char logo16_glcd_bmp[] =
{ 0B00000000, 0B11000000,
0B00000001, 0B11000000,
0B00000001, 0B11000000,
0B00000011, 0B11100000,
0B11110011, 0B11100000,
0B11111110, 0B11111000,
0B01111110, 0B11111111,
0B00110011, 0B10011111,
0B00011111, 0B11111100,
0B00001101, 0B01110000,
0B00011011, 0B10100000,
0B00111111, 0B11100000,
0B00111111, 0B11110000,
0B01111100, 0B11110000,
0B01110000, 0B01110000,
0B00000000, 0B00110000 };
#if (SSD1306_LCDHEIGHT != 64)
#error("Height incorrect, please fix Adafruit_SSD1306.h!");
#endif
void setup()
{
Time.zone(-5);
Serial.begin(9600);
display.begin(SSD1306_SWITCHCAPVCC);
display.display(); // show splashscreen
delay(2000);
display.clearDisplay(); // clears the screen and buffer
display.setTextSize(2);
display.setTextColor(WHITE);
display.setCursor(0,0);
display.println("AG");
display.display();
delay(2000);
}
void loop()
{
static int lastSecond = 61;
if (Time.second() != lastSecond)
{
char myTimeString[125] = "";
const int currentTime = Time.now();
sprintf(myTimeString, "%02d:%02d:%02d", Time.hour(currentTime), Time.minute(currentTime), Time.second(currentTime));
display.clearDisplay(); // clears the screen and buffer
display.setTextSize(2);
display.setTextColor(WHITE);
display.setCursor(0,0);
display.println(myTimeString);
display.display();
lastSecond = Time.second(currentTime);
}
}