Simon Ford
/
EAOLEDExample
A test example using the OLED display on the Embedded Artists Xpresso baseboard
Embed:
(wiki syntax)
Show/hide line numbers
main.cpp
00001 // example to test out OLED on mbed + XPresso baseboard, sford 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 for (int y=30; y<64; y++) { 00023 for (int x=5; x<90; x++) { 00024 oled.pixel(x - 4, y, 0x000000); 00025 oled.pixel(x + 4, y, 0xFFFFFF); 00026 wait(0.002); 00027 } 00028 } 00029 oled.locate(1,5); 00030 oled.printf("Bye from"); 00031 oled.locate(1,6); 00032 oled.printf("mbed.org"); 00033 }
Generated on Wed Jul 13 2022 10:17:56 by 1.7.2