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

Dependencies:   mbed

Committer:
Lerche
Date:
Sun Oct 03 08:40:47 2010 +0000
Revision:
0:ff072ee9597c

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Lerche 0:ff072ee9597c 1 // example to test out OLED on mbed + XPresso baseboard, sford, Lerche
Lerche 0:ff072ee9597c 2
Lerche 0:ff072ee9597c 3 #include "mbed.h"
Lerche 0:ff072ee9597c 4 #include "EAOLED.h"
Lerche 0:ff072ee9597c 5
Lerche 0:ff072ee9597c 6 // NOTE: The xpresso board does not provide the data/command signal to the mbed, so I added a wire:
Lerche 0:ff072ee9597c 7 // Connect:
Lerche 0:ff072ee9597c 8 // PIO2_7 of baseboard mbed socket (empty 2nd hole below mbed pin 21)
Lerche 0:ff072ee9597c 9 // to
Lerche 0:ff072ee9597c 10 // PIO0_8(p13) of J6 (7th hole down on left side of J6)
Lerche 0:ff072ee9597c 11 // to provide OLED data/command signal
Lerche 0:ff072ee9597c 12
Lerche 0:ff072ee9597c 13 EAOLED oled(p5, p6, p7, p8, p25); // mosi, dnc, sclk, cs, power
Lerche 0:ff072ee9597c 14
Lerche 0:ff072ee9597c 15 int main() {
Lerche 0:ff072ee9597c 16 oled.cls();
Lerche 0:ff072ee9597c 17 oled.printf("Hello World!");
Lerche 0:ff072ee9597c 18 wait(1);
Lerche 0:ff072ee9597c 19 oled.locate(0,5);
Lerche 0:ff072ee9597c 20 oled.printf("I'm an OLED!");
Lerche 0:ff072ee9597c 21 wait(1);
Lerche 0:ff072ee9597c 22 oled.cls();
Lerche 0:ff072ee9597c 23 oled.hline(10,50,10,0xFFFFFF);
Lerche 0:ff072ee9597c 24 oled.locate(0,5);
Lerche 0:ff072ee9597c 25 oled.printf("Horizontal");
Lerche 0:ff072ee9597c 26 wait(2);
Lerche 0:ff072ee9597c 27 oled.cls();
Lerche 0:ff072ee9597c 28 oled.vline(10,30,63,0xFFFFFF);
Lerche 0:ff072ee9597c 29 oled.locate(0,5);
Lerche 0:ff072ee9597c 30 oled.printf("Vertical");
Lerche 0:ff072ee9597c 31 wait(2);
Lerche 0:ff072ee9597c 32 oled.cls();
Lerche 0:ff072ee9597c 33 oled.line(10,10,40,30,0xFFFFFF);
Lerche 0:ff072ee9597c 34 oled.locate(0,5);
Lerche 0:ff072ee9597c 35 oled.printf("oblique");
Lerche 0:ff072ee9597c 36 wait(2);
Lerche 0:ff072ee9597c 37 oled.cls();
Lerche 0:ff072ee9597c 38 oled.rect(10,10,30,30,0xFFFFFF);
Lerche 0:ff072ee9597c 39 oled.rect(50,5,60,25,0xFFFFFF);
Lerche 0:ff072ee9597c 40 oled.locate(0,5);
Lerche 0:ff072ee9597c 41 oled.printf("Rectangle");
Lerche 0:ff072ee9597c 42 wait(2);
Lerche 0:ff072ee9597c 43 oled.cls();
Lerche 0:ff072ee9597c 44 oled.fillrect(10,10,30,30,0xFFFFFF);
Lerche 0:ff072ee9597c 45 oled.locate(0,5);
Lerche 0:ff072ee9597c 46 oled.printf("Filled");
Lerche 0:ff072ee9597c 47 wait(2);
Lerche 0:ff072ee9597c 48 oled.cls();
Lerche 0:ff072ee9597c 49 oled.circle(10,10,7,0xFFFFFF);
Lerche 0:ff072ee9597c 50 oled.locate(0,5);
Lerche 0:ff072ee9597c 51 oled.printf("Circle");
Lerche 0:ff072ee9597c 52 }