Tuesday, October 24, 2017

Arduino : Intermediate - OLED I2C Small Font Function

Description
Demonstrates the use a 128x64 I2C OLED display for small font function.  You can download OLED I2C library at Rinky-Dink Electronic.

List Item
  1. Arduino Uno 
  2. 128x64 I2C OLED  
Wiring Diagram

Video


Coding
#include <OLED_I2C.h>

OLED  myOLED(SDA, SCL, 8);

extern uint8_t SmallFont[];

void setup()
{
  myOLED.begin();
  myOLED.setFont(SmallFont);
}

void loop()
{
  myOLED.clrScr();
  myOLED.print("ROW 1", CENTER, 0);
  myOLED.print("ROW 2", CENTER, 8);
  myOLED.print("ROW 3", CENTER, 16);
  myOLED.print("ROW 4", CENTER, 24);
  myOLED.print("ROW 5", CENTER, 32);
  myOLED.print("ROW 6", CENTER, 40);
  myOLED.print("ROW 7", CENTER, 48);
  myOLED.print("ROW 8", CENTER, 56);
  myOLED.update();
  delay (5000);

  myOLED.clrScr();
  myOLED.print("ROW 1", LEFT, 0);
  myOLED.print("ROW 2", LEFT, 8);
  myOLED.print("ROW 3", LEFT, 16);
  myOLED.print("ROW 4", LEFT, 24);
  myOLED.print("ROW 5", LEFT, 32);
  myOLED.print("ROW 6", LEFT, 40);
  myOLED.print("ROW 7", LEFT, 48);
  myOLED.print("ROW 8", LEFT, 56);
  myOLED.update();
  delay (5000);

  myOLED.clrScr();
  myOLED.print("ROW 1", RIGHT, 0);
  myOLED.print("ROW 2", RIGHT, 8);
  myOLED.print("ROW 3", RIGHT, 16);
  myOLED.print("ROW 4", RIGHT, 24);
  myOLED.print("ROW 5", RIGHT, 32);
  myOLED.print("ROW 6", RIGHT, 40);
  myOLED.print("ROW 7", RIGHT, 48);
  myOLED.print("ROW 8", RIGHT, 56);
  myOLED.update();
  delay (5000);
}

No comments:

Post a Comment