Demo for using bitmap graphic

Dependencies:   C12832_lcd LCD_fonts mbed

Fork of app-board-LCD by Chris Styles

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "C12832_lcd.h"
00003 #include "Arial_9.h"
00004 #include "Small_7.h"
00005 #include "graphics.h"
00006 
00007 C12832_LCD lcd;
00008 
00009 int main()
00010 {
00011     int i,s;
00012     lcd.cls();
00013     lcd.set_font((unsigned char*) Arial_9);
00014     s = 3;
00015     lcd.print_bm(bitmTree,95,0);  // print chistmas tree
00016     lcd.copy_to_lcd(); 
00017     lcd.setmode(XOR);             // XOR - a second print will erase  
00018     for(i = -15; i < 75; ){     
00019         lcd.print_bm(bitmSan1,i,2);
00020         wait(0.5);
00021         lcd.copy_to_lcd();           // update lcd  
00022         lcd.print_bm(bitmSan1,i,2);  // erase
00023         i= i+s;
00024         lcd.print_bm(bitmSan2,i,2);  // print next
00025         wait(0.5);
00026         lcd.copy_to_lcd();           // update lcd   
00027         lcd.print_bm(bitmSan2,i,2);  // erase
00028         i= i+s;
00029         lcd.print_bm(bitmSan3,i,2);  // print next 
00030         wait(0.5);
00031         lcd.copy_to_lcd();           // update lcd
00032         lcd.print_bm(bitmSan3,i,2);  // erase
00033         i= i+s;
00034    }
00035    lcd.print_bm(bitmSan3,i,2);
00036    lcd.set_auto_up(0);
00037    for(i=-20; i<5; i++){             // scrolling text
00038      lcd.locate(5,i);
00039      lcd.printf("Happy");
00040      lcd.locate(5,i+12);
00041      lcd.printf("Christmas");
00042      lcd.copy_to_lcd();
00043      lcd.locate(5,i);
00044      wait(0.2);
00045      lcd.printf("Happy");
00046      lcd.locate(5,i+12);
00047      lcd.printf("Christmas");
00048      lcd.copy_to_lcd();
00049      i=i+1;
00050    }  
00051    lcd.locate(5,i);
00052    lcd.printf("Happy");
00053    lcd.locate(5,i+12);
00054    lcd.printf("Christmas");
00055    lcd.copy_to_lcd();
00056    
00057 }