Introduction to U8Glib using Arduino UNO and OLED 128x64 I2C

Hello World on U8Glib

Hello World application for Arduino UNO & OLED Mini 128X64 0.96 inch is quite simple. Make the connections as below and upload the code and you're good to go. Please note that you will need to add U8GLib library using Sketch>Include Library>Manage Libraries

But what I want to really cover here is the picture loop for the U8GLib. As you keep connecting more IOT devices your code will easily get unreadable. So I would like to split my pages into functions so in each function I can manage different sensors or inputs in general. So let's leave this "Hello World" application here and get deep into coding with Picture Loop.

Arduino UNO - OLED connection

#include "U8glib.h"

U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE|U8G_I2C_OPT_DEV_0); // I2C / TWI

void draw() {
u8g.setFont(u8g_font_unifont);
u8g.drawStr( 0, 22, "Hello Cuneyt");
}

void setup(void) {

}

void loop(void) {
// picture loop
u8g.firstPage();
int i = 0;
do {
draw();
} while( u8g.nextPage() );

delay(1000);
}