Getting something useful from the SSD1306 OLED

I throw this into the mix because I haven't seen a useful demo of this neat little device - just some dumb hello world stuff. I gave up on several libraries and I was getting the impression that it was not a very good replacement for the Nokia 5110, principally because of the lack of cursor control, and that text really is tiny. This is wrong. Adafruit's ASCII libraries are OK - even if the demos aren't. I got a hint that there actually is some cursor control and found it by guessing.

When things are running, just two readings are all I really need and the larger font is quite excellent. The display offers eight lines of text on the standard 5x7 font. Very small, but not that hard to read, and two more than the 5110. The cursor control goes out of wack with larger fonts, but that is OK.

It appears that the display saves on power by having a rapidly pulsing display. One photograph I took shows the screen completely blank.

// Test for minimum program size.
// Use smaller faster AvrI2c class in place of Wire.
// FONTS ARE CASE SENSITIVE See Documentation.html in SSD1038Text
#include "SSD1306Ascii.h"
#include "SSD1306AsciiAvrI2c.h"
// 0X3C+SA0 - 0x3C or 0x3D
#define I2C_ADDRESS 0x3C
SSD1306AsciiAvrI2c oled;
float a, b, c, d;
//------------------------------------------------------------------------------
void setup() {
  a = 7.6;
  b = 33.6;
  c = 41.2;
  d = 8.7;
  oled.begin(&Adafruit128x64, I2C_ADDRESS);
  oled.setFont(Adafruit5x7);
  //oled.setFont(Callibri14);
  uint32_t m = micros();
  oled.clear();

  oled.setRow(0);
  oled.print("input temp  = ");
  oled.setCursor(90, 0);
  oled.println(a, 1);
  oled.setRow(1);
  oled.print("output temp = ");
  oled.setCursor(90, 1);
  oled.println(b, 1);
  oled.setRow(2);
  oled.print("shr         = ");
  oled.setCursor(90, 2);
  oled.println(c, 1);
  oled.setRow(3);
  oled.print("gain        = ");
  oled.setCursor(90, 3);
  oled.println(d, 1);
  oled.setRow(4);
  oled.print("line 5      =");
  oled.setCursor(90, 4);
  oled.println(b, 1);
  oled.setRow(5);
  oled.print("line 6      =");
  oled.setCursor(90, 5);
  oled.println(b, 1);
  delay(1000);
  oled.setRow(6);
  oled.print("line 7      =");
  oled.setCursor(90, 6);
  oled.println(a, 1);
  delay(1000);
  oled.setRow(7);
  oled.print("line 8      =");
  oled.setCursor(90, 7);
  oled.println(b, 1);
delay(5000);

  oled.setCursor(90, 0);
  oled.println(b, 1);
  delay(120);
  oled.setCursor(90, 1);
  oled.println(d, 1);
  delay(120);
  oled.setCursor(90, 2);
  oled.println(a, 1);
  delay(120);
  oled.setCursor(90, 3);
  oled.println(b, 1);
  delay(120);
  oled.setCursor(90, 4);
  oled.println(c, 1);
  delay(120);
  oled.setCursor(90, 5);
  oled.println(d, 1);
  delay(120);
  oled.setCursor(90, 6);
  oled.println(c, 1);
  delay(120);
  oled.setCursor(90, 7);
  oled.println(a, 1);
delay(5000);
  
  oled.clear();
  oled.setFont(Stang5x7);
  oled.set2X();
  oled.println("rise    kW");
  oled.println();
}
//--------------------------------------
void loop() {
  delay(1000);
  d = d + 0.46;
  a = a + 0.18;
  oled.setCursor(0, 4);// "row 4" (deeper row)
  if(d<10.0)
  {
    oled.print(" ");
  }
  oled.print(d, 1);
  oled.print("   ");
  oled.print(a, 1);
  oled.print("     ");
  if (a > 9.5)
  {
    d = 0;
    a = 0;
  }
}

This was very helpfull for me. Thank you for sharing.

Glad to be of help. This is a rather neat little display.

This is dope. Thank you.