Christmas-LCD

Dependencies:   C12832_lcd LCD_fonts mbed

Fork of Christmas-LCD by Peter Drescher

Revision:
3:48407a94ff89
Parent:
2:a87e255a8f3a
Child:
4:398a45cdff06
diff -r a87e255a8f3a -r 48407a94ff89 main.cpp
--- a/main.cpp	Fri Oct 26 10:49:28 2012 +0000
+++ b/main.cpp	Fri Dec 21 21:59:16 2012 +0000
@@ -1,19 +1,57 @@
 #include "mbed.h"
 #include "C12832_lcd.h"
+#include "Arial_9.h"
+#include "Small_7.h"
+#include "graphics.h"
 
 C12832_LCD lcd;
 
 int main()
 {
-    int j=0;
+    int i,s;
     lcd.cls();
-    lcd.locate(0,3);
-    lcd.printf("mbed application board!");
-
-    while(true) {   // this is the third thread
-        lcd.locate(0,15);
-        lcd.printf("Counting : %d",j);
-        j++;
-        wait(1.0);
-    }
+    lcd.set_font((unsigned char*) Arial_9);
+    s = 3;
+    lcd.print_bm(bitmTree,95,0);  // print chistmas tree
+    lcd.copy_to_lcd(); 
+    lcd.setmode(XOR);             // XOR - a second print will erase  
+    for(i = -15; i < 75; ){     
+        lcd.print_bm(bitmSan1,i,2);
+        wait(0.5);
+        lcd.copy_to_lcd();           // update lcd  
+        lcd.print_bm(bitmSan1,i,2);  // erase
+        i= i+s;
+        lcd.print_bm(bitmSan2,i,2);  // print next
+        wait(0.5);
+        lcd.copy_to_lcd();           // update lcd   
+        lcd.print_bm(bitmSan2,i,2);  // erase
+        i= i+s;
+        lcd.print_bm(bitmSan3,i,2);  // print next 
+        wait(0.5);
+        lcd.copy_to_lcd();           // update lcd
+        lcd.print_bm(bitmSan3,i,2);  // erase
+        i= i+s;
+   }
+   lcd.print_bm(bitmSan3,i,2);
+   lcd.set_auto_up(0);
+   for(i=-20; i<5; i++){             // scrolling text
+     lcd.locate(5,i);
+     lcd.printf("Happy");
+     lcd.locate(5,i+12);
+     lcd.printf("Christmas");
+     lcd.copy_to_lcd();
+     lcd.locate(5,i);
+     wait(0.2);
+     lcd.printf("Happy");
+     lcd.locate(5,i+12);
+     lcd.printf("Christmas");
+     lcd.copy_to_lcd();
+     i=i+1;
+   }  
+   lcd.locate(5,i);
+   lcd.printf("Happy");
+   lcd.locate(5,i+12);
+   lcd.printf("Christmas");
+   lcd.copy_to_lcd();
+   
 }