Wednesday, October 25, 2017

Arduino : Intermediate - OLED I2C Tiny Font Function

Description
Demonstrates the use a 128x64 I2C OLED display for tiny 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 TinyFont[];

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

void loop()
{
  myOLED.clrScr();
  myOLED.print("ROW 1", CENTER, 4);
  myOLED.print("ROW 2", CENTER, 10);
  myOLED.print("ROW 3", CENTER, 16);
  myOLED.print("ROW 4", CENTER, 22);
  myOLED.print("ROW 5", CENTER, 28);
  myOLED.print("ROW 6", CENTER, 34);
  myOLED.print("ROW 7", CENTER, 40);
  myOLED.print("ROW 8", CENTER, 46);
  myOLED.print("ROW 9", CENTER, 52);
  myOLED.print("ROW 10", CENTER, 58);
  myOLED.update();
  delay (5000);

  myOLED.clrScr();
  myOLED.print("ROW 1", LEFT, 4);
  myOLED.print("ROW 2", LEFT, 10);
  myOLED.print("ROW 3", LEFT, 16);
  myOLED.print("ROW 4", LEFT, 22);
  myOLED.print("ROW 5", LEFT, 28);
  myOLED.print("ROW 6", LEFT, 34);
  myOLED.print("ROW 7", LEFT, 40);
  myOLED.print("ROW 8", LEFT, 46);
  myOLED.print("ROW 9", LEFT, 52);
  myOLED.print("ROW 10", LEFT, 58);
  myOLED.update();
  delay (5000);

  myOLED.clrScr();
  myOLED.print("ROW 1", RIGHT, 4);
  myOLED.print("ROW 2", RIGHT, 10);
  myOLED.print("ROW 3", RIGHT, 16);
  myOLED.print("ROW 4", RIGHT, 22);
  myOLED.print("ROW 5", RIGHT, 28);
  myOLED.print("ROW 6", RIGHT, 34);
  myOLED.print("ROW 7", RIGHT, 40);
  myOLED.print("ROW 8", RIGHT, 46);
  myOLED.print("ROW 9", RIGHT, 52);
  myOLED.print("ROW 10", RIGHT, 58);
  myOLED.update();
  delay (5000);
}

No comments:

Post a Comment