Change oled circuit from spi to i2c

ive just built an egg timer which works great - but now wanting to make it a bit tidier - the circuit uses an SPI (6pin) oled - i have now aquired a bigger and nicer oled but its I2C (4 pin) ... how can i convert the circuit to use the I2C - the circuit uses an arduino nano

the sketch is as follows:

// Mario's Ideas
// Eggtimer created with Arduino and Millis
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 32 // OLED display height, in pixels

#define Buzzer 12

int minutes_change=0;
int minutes=0;
int Current_Frame=1;

// State values 0 - setup 1- countdown
int State=0;
long Timestamp_Button_Pressed;

unsigned long Countdown_start;

// Declaration for SSD1306 display connected using software SPI 
#define OLED_MOSI   5
#define OLED_CLK   4
#define OLED_DC    7
#define OLED_CS    8
#define OLED_RESET 6
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT,OLED_MOSI, OLED_CLK, OLED_DC, OLED_RESET, OLED_CS);





// 'Marios_ideas', 128x32px
const unsigned char Logo [] PROGMEM = {
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
  0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
  0x00, 0x03, 0xce, 0x00, 0x00, 0x1e, 0x00, 0x04, 0x00, 0x1c, 0x7f, 0x8f, 0xff, 0xff, 0xff, 0xff, 
  0x00, 0x07, 0xff, 0x00, 0x00, 0x0c, 0x00, 0x0e, 0x00, 0x1c, 0x7f, 0x8f, 0xff, 0xff, 0xff, 0xff, 
  0x00, 0x0f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x1c, 0x7f, 0x8f, 0xff, 0xff, 0xff, 0xff, 
  0x00, 0x0e, 0x73, 0x87, 0x81, 0xdc, 0x1e, 0x08, 0x0c, 0x1c, 0x7c, 0x8f, 0x0f, 0xc3, 0xfc, 0xff, 
  0x00, 0x0e, 0x73, 0x8f, 0xc3, 0xdc, 0x7f, 0x00, 0x1c, 0x1c, 0x78, 0x8e, 0x07, 0x81, 0xf8, 0xff, 
  0x00, 0x0e, 0x73, 0x9f, 0xe3, 0x9c, 0x7f, 0x00, 0x3c, 0x1c, 0x70, 0x8c, 0x03, 0x00, 0xf0, 0xff, 
  0x00, 0x0e, 0x73, 0x9c, 0x63, 0x1c, 0xe3, 0x80, 0x3c, 0x1c, 0x71, 0x8c, 0x63, 0x1c, 0xf0, 0xff, 
  0x00, 0x0e, 0x73, 0x98, 0x63, 0x1c, 0xe3, 0x80, 0x38, 0x1c, 0x73, 0x8c, 0xc3, 0x3c, 0xf3, 0xff, 
  0x00, 0x0e, 0x73, 0x9c, 0x63, 0x1c, 0xe3, 0x80, 0x38, 0x1c, 0x71, 0x8c, 0x7f, 0x1c, 0xf3, 0xff, 
  0x00, 0x0e, 0x73, 0x9f, 0x63, 0x1c, 0x7f, 0x00, 0xf8, 0x1c, 0x70, 0x1c, 0x3f, 0x0c, 0xc3, 0xff, 
  0x00, 0x0e, 0x73, 0x8f, 0x63, 0x1c, 0x7f, 0x00, 0xf0, 0x1c, 0x78, 0x1e, 0x1f, 0x8c, 0xc7, 0xff, 
  0x00, 0x0e, 0x73, 0x87, 0x63, 0x1c, 0x1c, 0x00, 0xe0, 0x1c, 0x7c, 0x7f, 0x0f, 0xcc, 0xcf, 0xff, 
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
};

// 'Marios_ideas', 128x32px
const unsigned char Logo1 [] PROGMEM = {
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  0xff, 0xff, 0xff, 0xff, 0xff, 0xf3, 0xff, 0xff, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  0xff, 0xfc, 0x31, 0xff, 0xff, 0xe1, 0xff, 0xfb, 0xff, 0xe3, 0x80, 0x70, 0x00, 0x00, 0x00, 0x00, 
  0xff, 0xf8, 0x00, 0xff, 0xff, 0xf3, 0xff, 0xf1, 0xff, 0xe3, 0x80, 0x70, 0x00, 0x00, 0x00, 0x00, 
  0xff, 0xf0, 0x00, 0x7f, 0xff, 0xff, 0xff, 0xe3, 0xff, 0xe3, 0x80, 0x70, 0x00, 0x00, 0x00, 0x00, 
  0xff, 0xf1, 0x8c, 0x78, 0x7e, 0x23, 0xe1, 0xf7, 0xf3, 0xe3, 0x83, 0x70, 0xf0, 0x3c, 0x03, 0x00, 
  0xff, 0xf1, 0x8c, 0x70, 0x3c, 0x23, 0x80, 0xff, 0xe3, 0xe3, 0x87, 0x71, 0xf8, 0x7e, 0x07, 0x00, 
  0xff, 0xf1, 0x8c, 0x60, 0x1c, 0x63, 0x80, 0xff, 0xc3, 0xe3, 0x8f, 0x73, 0xfc, 0xff, 0x0f, 0x00, 
  0xff, 0xf1, 0x8c, 0x63, 0x9c, 0xe3, 0x1c, 0x7f, 0xc3, 0xe3, 0x8e, 0x73, 0x9c, 0xe3, 0x0f, 0x00, 
  0xff, 0xf1, 0x8c, 0x67, 0x9c, 0xe3, 0x1c, 0x7f, 0xc7, 0xe3, 0x8c, 0x73, 0x3c, 0xc3, 0x0c, 0x00, 
  0xff, 0xf1, 0x8c, 0x63, 0x9c, 0xe3, 0x1c, 0x7f, 0xc7, 0xe3, 0x8e, 0x73, 0x80, 0xe3, 0x0c, 0x00, 
  0xff, 0xf1, 0x8c, 0x60, 0x9c, 0xe3, 0x80, 0xff, 0x07, 0xe3, 0x8f, 0xe3, 0xc0, 0xf3, 0x3c, 0x00, 
  0xff, 0xf1, 0x8c, 0x70, 0x9c, 0xe3, 0x80, 0xff, 0x0f, 0xe3, 0x87, 0xe1, 0xe0, 0x73, 0x38, 0x00, 
  0xff, 0xf1, 0x8c, 0x78, 0x9c, 0xe3, 0xe3, 0xff, 0x1f, 0xe3, 0x83, 0x80, 0xf0, 0x33, 0x30, 0x00, 
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};

// 'Bell1', 58x32px
const unsigned char Bell1 [] PROGMEM = {
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xff, 0xc3, 0xff, 0xff, 0xff, 0xc0, 
  0xff, 0xff, 0xff, 0xdb, 0xff, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xff, 0x99, 0xff, 0xff, 0xff, 0xc0, 
  0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xfc, 0x00, 0x3f, 0xff, 0xff, 0xc0, 
  0xff, 0xff, 0xf8, 0x00, 0x1f, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xf8, 0x00, 0x1f, 0xff, 0xff, 0xc0, 
  0xff, 0xff, 0xf8, 0x00, 0x0f, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xf0, 0x00, 0x0f, 0xff, 0xff, 0xc0, 
  0xff, 0xff, 0xf0, 0x00, 0x0f, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xf0, 0x00, 0x0f, 0xff, 0xff, 0xc0, 
  0xff, 0xff, 0xe0, 0x00, 0x0f, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xe0, 0x00, 0x07, 0xff, 0xff, 0xc0, 
  0xff, 0xff, 0xe0, 0x00, 0x07, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xe0, 0x00, 0x07, 0xff, 0xff, 0xc0, 
  0xff, 0xff, 0xe0, 0x00, 0x07, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xe0, 0x00, 0x07, 0xff, 0xff, 0xc0, 
  0xff, 0xff, 0xc0, 0x00, 0x03, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xc0, 0x00, 0x03, 0xff, 0xff, 0xc0, 
  0xff, 0xff, 0x80, 0x00, 0x01, 0xff, 0xff, 0xc0, 0xff, 0xfe, 0x00, 0x00, 0x00, 0x7f, 0xff, 0xc0, 
  0xff, 0xfe, 0x00, 0x00, 0x00, 0x7f, 0xff, 0xc0, 0xff, 0xfc, 0x00, 0x00, 0x00, 0x3f, 0xff, 0xc0, 
  0xff, 0xfc, 0x00, 0x00, 0x00, 0x3f, 0xff, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xc0, 
  0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xff, 0x81, 0xff, 0xff, 0xff, 0xc0, 
  0xff, 0xff, 0xff, 0xe7, 0xff, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0
};
// 'Bell2', 58x32px
const unsigned char Bell2 [] PROGMEM = {
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xff, 0xc3, 0xff, 0xff, 0xff, 0xc0, 
  0xff, 0xff, 0xff, 0xdb, 0xff, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xff, 0x99, 0xff, 0xff, 0xff, 0xc0, 
  0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xfc, 0x00, 0x3f, 0xff, 0xff, 0xc0, 
  0xff, 0xff, 0xf8, 0x00, 0x1f, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xf8, 0x00, 0x1f, 0xff, 0xff, 0xc0, 
  0xff, 0xff, 0xf8, 0x00, 0x0f, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xf0, 0x00, 0x0f, 0xff, 0xff, 0xc0, 
  0xff, 0xfb, 0xf0, 0x00, 0x0f, 0xdf, 0xff, 0xc0, 0xff, 0xfb, 0xf0, 0x00, 0x0f, 0xdf, 0xff, 0xc0, 
  0xff, 0xf3, 0xe0, 0x00, 0x0f, 0xcf, 0xff, 0xc0, 0xff, 0xf3, 0xe0, 0x00, 0x07, 0xcf, 0xff, 0xc0, 
  0xff, 0xf3, 0xe0, 0x00, 0x07, 0xcf, 0xff, 0xc0, 0xff, 0xfb, 0xe0, 0x00, 0x07, 0xdf, 0xff, 0xc0, 
  0xff, 0xfb, 0xe0, 0x00, 0x07, 0xdf, 0xff, 0xc0, 0xff, 0xff, 0xe0, 0x00, 0x07, 0xff, 0xff, 0xc0, 
  0xff, 0xff, 0xc0, 0x00, 0x03, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xc0, 0x00, 0x03, 0xff, 0xff, 0xc0, 
  0xff, 0xff, 0x80, 0x00, 0x01, 0xff, 0xff, 0xc0, 0xff, 0xfe, 0x00, 0x00, 0x00, 0x7f, 0xff, 0xc0, 
  0xff, 0xfe, 0x00, 0x00, 0x00, 0x7f, 0xff, 0xc0, 0xff, 0xfc, 0x00, 0x00, 0x00, 0x3f, 0xff, 0xc0, 
  0xff, 0xfc, 0x00, 0x00, 0x00, 0x3f, 0xff, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xc0, 
  0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xff, 0x81, 0xff, 0xff, 0xff, 0xc0, 
  0xff, 0xff, 0xff, 0xe7, 0xff, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0
};
// 'Bell3', 58x32px
const unsigned char Bell3 [] PROGMEM = {
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xff, 0xc3, 0xff, 0xff, 0xff, 0xc0, 
  0xff, 0xff, 0xff, 0xdb, 0xff, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xff, 0x99, 0xff, 0xff, 0xff, 0xc0, 
  0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xfc, 0x00, 0x3f, 0xff, 0xff, 0xc0, 
  0xff, 0xff, 0xf8, 0x00, 0x1f, 0xff, 0xff, 0xc0, 0xff, 0xdf, 0xf8, 0x00, 0x1f, 0xfb, 0xff, 0xc0, 
  0xff, 0x9f, 0xf8, 0x00, 0x0f, 0xf9, 0xff, 0xc0, 0xff, 0x1f, 0xf0, 0x00, 0x0f, 0xf8, 0xff, 0xc0, 
  0xfe, 0x3b, 0xf0, 0x00, 0x0f, 0xdc, 0x7f, 0xc0, 0xfe, 0x3b, 0xf0, 0x00, 0x0f, 0xdc, 0x7f, 0xc0, 
  0xfe, 0x73, 0xe0, 0x00, 0x0f, 0xce, 0x7f, 0xc0, 0xfe, 0x73, 0xe0, 0x00, 0x07, 0xce, 0x7f, 0xc0, 
  0xfe, 0x73, 0xe0, 0x00, 0x07, 0xce, 0x7f, 0xc0, 0xfe, 0x7b, 0xe0, 0x00, 0x07, 0xde, 0x7f, 0xc0, 
  0xfe, 0x3b, 0xe0, 0x00, 0x07, 0xdc, 0x7f, 0xc0, 0xff, 0x3f, 0xe0, 0x00, 0x07, 0xfc, 0xff, 0xc0, 
  0xff, 0x9f, 0xc0, 0x00, 0x03, 0xf9, 0xff, 0xc0, 0xff, 0x9f, 0xc0, 0x00, 0x03, 0xf9, 0xff, 0xc0, 
  0xff, 0xff, 0x80, 0x00, 0x01, 0xff, 0xff, 0xc0, 0xff, 0xfe, 0x00, 0x00, 0x00, 0x7f, 0xff, 0xc0, 
  0xff, 0xfe, 0x00, 0x00, 0x00, 0x7f, 0xff, 0xc0, 0xff, 0xfc, 0x00, 0x00, 0x00, 0x3f, 0xff, 0xc0, 
  0xff, 0xfc, 0x00, 0x00, 0x00, 0x3f, 0xff, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xc0, 
  0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xff, 0x81, 0xff, 0xff, 0xff, 0xc0, 
  0xff, 0xff, 0xff, 0xe7, 0xff, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0
};
// 'Bell4', 58x32px
const unsigned char Bell4 [] PROGMEM = {
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xff, 0xc3, 0xff, 0xff, 0xff, 0xc0, 
  0xff, 0xff, 0xff, 0xdb, 0xff, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xff, 0x99, 0xff, 0xff, 0xff, 0xc0, 
  0xfd, 0xff, 0xff, 0x00, 0xff, 0xff, 0xbf, 0xc0, 0xf8, 0xff, 0xfc, 0x00, 0x3f, 0xff, 0x1f, 0xc0, 
  0xf1, 0xff, 0xf8, 0x00, 0x1f, 0xff, 0x8f, 0xc0, 0xf3, 0xdf, 0xf8, 0x00, 0x1f, 0xfb, 0xcf, 0xc0, 
  0xe3, 0x9f, 0xf8, 0x00, 0x0f, 0xf9, 0xc7, 0xc0, 0xe7, 0x1f, 0xf0, 0x00, 0x0f, 0xf8, 0xe7, 0xc0, 
  0xc6, 0x3b, 0xf0, 0x00, 0x0f, 0xdc, 0x63, 0xc0, 0xc6, 0x3b, 0xf0, 0x00, 0x0f, 0xdc, 0x63, 0xc0, 
  0xc6, 0x73, 0xe0, 0x00, 0x0f, 0xce, 0x63, 0xc0, 0xc6, 0x73, 0xe0, 0x00, 0x07, 0xce, 0x63, 0xc0, 
  0xc6, 0x73, 0xe0, 0x00, 0x07, 0xce, 0x63, 0xc0, 0xc6, 0x7b, 0xe0, 0x00, 0x07, 0xde, 0x63, 0xc0, 
  0xc6, 0x3b, 0xe0, 0x00, 0x07, 0xdc, 0x63, 0xc0, 0xe7, 0x3f, 0xe0, 0x00, 0x07, 0xfc, 0xe7, 0xc0, 
  0xe3, 0x9f, 0xc0, 0x00, 0x03, 0xf9, 0xc7, 0xc0, 0xf3, 0x9f, 0xc0, 0x00, 0x03, 0xf9, 0xcf, 0xc0, 
  0xf1, 0xff, 0x80, 0x00, 0x01, 0xff, 0x8f, 0xc0, 0xf8, 0xfe, 0x00, 0x00, 0x00, 0x7f, 0x1f, 0xc0, 
  0xfd, 0xfe, 0x00, 0x00, 0x00, 0x7f, 0xbf, 0xc0, 0xff, 0xfc, 0x00, 0x00, 0x00, 0x3f, 0xff, 0xc0, 
  0xff, 0xfc, 0x00, 0x00, 0x00, 0x3f, 0xff, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xc0, 
  0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xff, 0x81, 0xff, 0xff, 0xff, 0xc0, 
  0xff, 0xff, 0xff, 0xe7, 0xff, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0
};

void Press_A_Button(){
  if (millis() - Timestamp_Button_Pressed>200){
    if (State==0) minutes = minutes+1;
    Timestamp_Button_Pressed=millis();
  }
}

void Press_B_Button(){
  if (millis() - Timestamp_Button_Pressed>200){
    if (State==0){
      Countdown_start=millis();
      State=1; 
    }
    else{
      State=0;
      minutes =0;
    }
  }
}

void setup() {
  attachInterrupt(digitalPinToInterrupt(2), Press_A_Button,RISING);
  attachInterrupt(digitalPinToInterrupt(3), Press_B_Button,RISING);
  
  Timestamp_Button_Pressed=millis();

  pinMode(Buzzer, OUTPUT);
  digitalWrite(Buzzer,LOW);
  
  // SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally
  if(!display.begin(SSD1306_SWITCHCAPVCC)) {
    Serial.println(F("SSD1306 allocation failed"));
    for(;;); // Don't proceed, loop forever
  }
   Serial.begin(9600);
  // Show initial display buffer contents on the screen --
  // the library initializes this with an Adafruit splash screen.
  display.display();
  delay(2000); // Pause for 2 seconds

  // Displaying My Channel Logo
  // Displaying 4x Positive and Negative of the Channel Logo in sequence 
  
  for (int i=1 ; i<5; i++){
    display.clearDisplay();
    display.drawBitmap(0,0,Logo, 128, 32, 1);
    display.display();
    delay(500);
    display.clearDisplay();
    display.drawBitmap(0,0,Logo1, 128, 32, 1);
    display.display();
    delay(500);
  }
  display.clearDisplay();
  display.setTextSize(2);            
  display.setCursor(5,0);
  display.setTextColor(SSD1306_WHITE);
  display.println((String)minutes+" min");
  display.display();
}

void Ring_Bell(int Frame){
  display.clearDisplay();
  display.fillRect(0, 0, 30, 32, SSD1306_WHITE);
  display.fillRect(88, 0, 30, 32, SSD1306_WHITE);
  if (Frame==1)display.drawBitmap(30,0,Bell1, 58, 32, 1);
  if (Frame==2)display.drawBitmap(30,0,Bell2, 58, 32, 1);
  if (Frame==3)display.drawBitmap(30,0,Bell3, 58, 32, 1);
  if (Frame==4)display.drawBitmap(30,0,Bell4, 58, 32, 1);
  display.display();
  if (Frame>1){
    delay(200);
    digitalWrite(Buzzer,HIGH);
  }
  else {
    digitalWrite(Buzzer,LOW);
    delay(1000); 
  }
}

String TimeLeft(unsigned long MsLeft){
  String Result;
  int M;
  int S;
  M=(long)MsLeft/60000;
  Serial.print(MsLeft);
  Serial.print(";");
  Serial.println(M);
  if (M<10) Result=(String)"0"+ M + ":";else Result=(String)M+":";
  S=(long)((MsLeft-M*60000)/1000);
  if (S<10) Result=(String)Result + "0"+ S ;else Result=(String)Result +S;
  return Result;
  
}

void loop() {
  
  if (State==0 ){
    digitalWrite(Buzzer,LOW);
    display.clearDisplay();
    display.setTextSize(2);            
    display.setCursor(5,0);
    display.setTextColor(SSD1306_WHITE);
    display.println((String)minutes+" min");
    display.display();
  }
  if(State==1){
    if(minutes*60000 >(millis()-Countdown_start)){
      display.clearDisplay();
      display.setCursor(5,0);
      display.setTextSize(4);            
      display.setTextColor(SSD1306_WHITE);
      display.println(TimeLeft((minutes*60000-(millis()-Countdown_start)))); 
      display.display();
    } 
    else {
     Ring_Bell(Current_Frame); 
     Current_Frame=Current_Frame+1;
     if (Current_Frame==5) Current_Frame=1;
    }
  }
}

![diagram_qio4kHWGF9|690x456](upload://m5Ek9D21aefZOHE2UcTGCpkXfp5.jpeg)

You will need to convert not only the circuit, but additionally the code. First of all - do you have an Arduino library for manage your new I2c screen?

1 Like

Debouncing in an ISR is a bad pattern. Polling buttons should be done in loop() instead.

You risk much flicker when refreshing the display each loop() iteration. You better refresh only when the state changes, or after a minute when the time display really deserves an update.

1 Like

yes i believe so - adafruit/Adafruit_SSD1306 and adafruit_gfx.h librarys - i also believe the nano uses the pins SDA (A4) and SCL (A5) if that helps

thankyou - im very much trying to learn all this

  • Is this new OLED display an I2C 1306 ? :roll_eyes:

errrm very good point! its a 1309 ..... tut at me :blush: ill search for the drivers now

its a 1309 but on the last thing i used it on it ran under a 1306 library, and yes its a I2C

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.