Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include <string.h>
00002 #include "mbed.h"
00003 #include "OLEDSeps525f.h"
00004 OLEDSeps525f lcd(p5, p6, p7, p8, p9, p10);
00005 
00006 int main() {
00007     //Test background and clear screen
00008     lcd.background(0x0000FF);
00009     lcd.cls();
00010     //Test colour and fill
00011     lcd.fill(0, 50, lcd.width(), 10, 0x00FF00);
00012     lcd.fill(50, 0, 10, lcd.height(), 0xFF0000);
00013     //Test pixel writing
00014     for(int i=0; i<lcd.width(); i++) {
00015         lcd.pixel(i, 80 + sin((float)i / 5.0)*10, 0x000000);
00016     }
00017     lcd.locate(0,1);
00018     //Test text and newline
00019     lcd.printf("OLED\ndriver\n");
00020     //Test tab
00021     lcd.printf("\ttab\t2\t3\t4");
00022     lcd.locate(0,10);    
00023     //Test control codes
00024     lcd.printf("\t*\v*\v\b\b*\r*");
00025     //Test orientation
00026     lcd.locate(lcd.columns()/2-(strlen("Top  ")/2),1);
00027     lcd.printf("Top %u",lcd.orientation());
00028     lcd.orientation(1);
00029     lcd.locate(lcd.columns()/2-(strlen("Right  ")/2),1);
00030     lcd.printf("Right %u",lcd.orientation());
00031     lcd.orientation(2);
00032     lcd.locate(lcd.columns()/2-(strlen("Bottom  ")/2),1);
00033     lcd.printf("Bottom %u",lcd.orientation());
00034     lcd.orientation(3);
00035     lcd.locate(lcd.columns()/2-(strlen("Left  ")/2),1);
00036     lcd.printf("Left %u",lcd.orientation());
00037 
00038 }