Embedded Artists OLED Display

A 96x64 pixel white OLED display, as found on the Embedded Artists mbed Baseboard.

Hello World!

main.cpp

// example to test out OLED on mbed + XPresso baseboard, sford, Lerche

#include "mbed.h"
#include "EAOLED.h"

// NOTE: The xpresso board does not provide the data/command signal to the mbed, so I added a wire:
// Connect:
//  PIO2_7 of baseboard mbed socket (empty 2nd hole below mbed pin 21)
// to
//   PIO0_8(p13) of J6 (7th hole down on left side of J6)
// to provide OLED data/command signal

EAOLED oled(p5, p6, p7, p8, p25); // mosi, dnc, sclk, cs, power

int main() {
    oled.cls();
    oled.printf("Hello World!");
    wait(1);
    oled.locate(0,5);
    oled.printf("I'm an OLED!");
    wait(1);
    oled.cls();
    oled.hline(10,50,10,0xFFFFFF);
    oled.locate(0,5);
    oled.printf("Horizontal");
    wait(2);
    oled.cls();
    oled.vline(10,30,63,0xFFFFFF);
    oled.locate(0,5);
    oled.printf("Vertical");
    wait(2);
    oled.cls();
    oled.line(10,10,40,30,0xFFFFFF);
    oled.locate(0,5);
    oled.printf("oblique");
    wait(2);
    oled.cls();
    oled.rect(10,10,30,30,0xFFFFFF);
    oled.rect(50,5,60,25,0xFFFFFF);
    oled.locate(0,5);
    oled.printf("Rectangle");
    wait(2);
    oled.cls();
    oled.fillrect(10,10,30,30,0xFFFFFF);
    oled.locate(0,5);
    oled.printf("Filled");
    wait(2);
    oled.cls();
    oled.circle(10,10,7,0xFFFFFF);
    oled.locate(0,5);
    oled.printf("Circle");
}

Warning

The xpresso board does not provide the data/command signal to the mbed, so I added a wire:

Connect:

  • PIO2_7 of baseboard mbed socket (empty 2nd hole below mbed pin 21) to
  • PIO0_8(p13) of J6 (7th hole down on left side of J6) to provide OLED data/command signal

OLED enable wire

Library

Here is a library to drive the display:

Examples

Reference


All wikipages