Monday, October 30, 2017

Arduino : Intermediate - OLED I2C Number Font Function

Description
Demonstrates the use a 128x64 I2C OLED display for medium numbers and big numbers 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 MediumNumbers[];
extern uint8_t BigNumbers[];

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

void loop()
{
  for (int i=0; i<=100; i++)
  {
    myOLED.setFont(MediumNumbers);
    myOLED.printNumF(float(i)/3, 2, RIGHT, 0);
    myOLED.setFont(BigNumbers);
    myOLED.printNumI(i, RIGHT, 40);
    myOLED.update();
  }
  myOLED.clrScr();
}

No comments:

Post a Comment