A test example using the OLED display on the Embedded Artists Xpresso baseboard

Dependencies:   mbed

Committer:
simon
Date:
Sun Feb 28 16:04:59 2010 +0000
Revision:
0:f42b25503fd1

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
simon 0:f42b25503fd1 1 // example to test out OLED on mbed + XPresso baseboard, sford
simon 0:f42b25503fd1 2
simon 0:f42b25503fd1 3 #include "mbed.h"
simon 0:f42b25503fd1 4 #include "EAOLED.h"
simon 0:f42b25503fd1 5
simon 0:f42b25503fd1 6 // NOTE: The xpresso board does not provide the data/command signal to the mbed, so I added a wire:
simon 0:f42b25503fd1 7 // Connect:
simon 0:f42b25503fd1 8 // PIO2_7 of baseboard mbed socket (empty 2nd hole below mbed pin 21)
simon 0:f42b25503fd1 9 // to
simon 0:f42b25503fd1 10 // PIO0_8(p13) of J6 (7th hole down on left side of J6)
simon 0:f42b25503fd1 11 // to provide OLED data/command signal
simon 0:f42b25503fd1 12
simon 0:f42b25503fd1 13 EAOLED oled(p5, p6, p7, p8, p25); // mosi, dnc, sclk, cs, power
simon 0:f42b25503fd1 14
simon 0:f42b25503fd1 15 int main() {
simon 0:f42b25503fd1 16 oled.cls();
simon 0:f42b25503fd1 17 oled.printf("Hello World!");
simon 0:f42b25503fd1 18 wait(1);
simon 0:f42b25503fd1 19 oled.locate(0,5);
simon 0:f42b25503fd1 20 oled.printf("I'm an OLED!");
simon 0:f42b25503fd1 21 wait(1);
simon 0:f42b25503fd1 22 for (int y=30; y<64; y++) {
simon 0:f42b25503fd1 23 for (int x=5; x<90; x++) {
simon 0:f42b25503fd1 24 oled.pixel(x - 4, y, 0x000000);
simon 0:f42b25503fd1 25 oled.pixel(x + 4, y, 0xFFFFFF);
simon 0:f42b25503fd1 26 wait(0.002);
simon 0:f42b25503fd1 27 }
simon 0:f42b25503fd1 28 }
simon 0:f42b25503fd1 29 oled.locate(1,5);
simon 0:f42b25503fd1 30 oled.printf("Bye from");
simon 0:f42b25503fd1 31 oled.locate(1,6);
simon 0:f42b25503fd1 32 oled.printf("mbed.org");
simon 0:f42b25503fd1 33 }