EA OLED Hello World (Runs through the different possibilities with the OLED software

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 // example to test out OLED on mbed + XPresso baseboard, sford, Lerche
00002 
00003 #include "mbed.h"
00004 #include "EAOLED.h"
00005 
00006 // NOTE: The xpresso board does not provide the data/command signal to the mbed, so I added a wire:
00007 // Connect:
00008 //  PIO2_7 of baseboard mbed socket (empty 2nd hole below mbed pin 21)
00009 // to
00010 //   PIO0_8(p13) of J6 (7th hole down on left side of J6)
00011 // to provide OLED data/command signal
00012 
00013 EAOLED oled(p5, p6, p7, p8, p25); // mosi, dnc, sclk, cs, power
00014 
00015 int main() {
00016     oled.cls();
00017     oled.printf("Hello World!");
00018     wait(1);
00019     oled.locate(0,5);
00020     oled.printf("I'm an OLED!");
00021     wait(1);
00022     oled.cls();
00023     oled.hline(10,50,10,0xFFFFFF);
00024     oled.locate(0,5);
00025     oled.printf("Horizontal");
00026     wait(2);
00027     oled.cls();
00028     oled.vline(10,30,63,0xFFFFFF);
00029     oled.locate(0,5);
00030     oled.printf("Vertical");
00031     wait(2);
00032     oled.cls();
00033     oled.line(10,10,40,30,0xFFFFFF);
00034     oled.locate(0,5);
00035     oled.printf("oblique");
00036     wait(2);
00037     oled.cls();
00038     oled.rect(10,10,30,30,0xFFFFFF);
00039     oled.rect(50,5,60,25,0xFFFFFF);
00040     oled.locate(0,5);
00041     oled.printf("Rectangle");
00042     wait(2);
00043     oled.cls();
00044     oled.fillrect(10,10,30,30,0xFFFFFF);
00045     oled.locate(0,5);
00046     oled.printf("Filled");
00047     wait(2);
00048     oled.cls();
00049     oled.circle(10,10,7,0xFFFFFF);
00050     oled.locate(0,5);
00051     oled.printf("Circle");
00052 }