#include <SPI.h>
#include <Wire.h>
#include <Adafruit_SSD1306.h>
#include <Adafruit_GFX.h>
// SPI - Serial Peripheral interface Used by microcontroller for serial communication with peripheral device
// Wire.h is for i2c protocol ic 2 ic
// Adafruit _SSD1306 this takes care of low level communication with the hard ware
// Adafruit_GFX - it offers some functions that will help to write graphical syntax
#define screen_width 128
#define screen_height 64
Adafruit_SSD1306 oled_display(screen_width,screen_height,&Wire,-1);
void setup() {
Serial.begin(115200);
if(!oled_display.begin(SSD1306_SWITCHCAPVCC,0x3C)){
Serial.println(F("SSD 1306 allocation failed "));
for(;;){}
}
delay(2000);
}
void loop() {
// draw a circle
oled_display.clearDisplay();
oled_display.drawCircle(50,30,30,WHITE);
oled_display.display();
delay(2000);
// fill the circle
oled_display.clearDisplay();
oled_display.fillCircle(50,30,30,WHITE);
oled_display.display();
delay(2000);
}
/*
128 x 64
8 pages
128 collums
each column has 8 bits of data
*/