![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
test
Dependencies: C12832_lcd LCD_fonts mbed
Fork of Christmas-LCD by
main.cpp.orig@9:9e72c0ff2759, 2016-12-01 (annotated)
- Committer:
- kaku_jyoko
- Date:
- Thu Dec 01 09:41:08 2016 +0000
- Revision:
- 9:9e72c0ff2759
???
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
kaku_jyoko | 9:9e72c0ff2759 | 1 | #include "mbed.h" |
kaku_jyoko | 9:9e72c0ff2759 | 2 | #include "C12832_lcd.h" |
kaku_jyoko | 9:9e72c0ff2759 | 3 | #include "Arial_9.h" |
kaku_jyoko | 9:9e72c0ff2759 | 4 | #include "Small_7.h" |
kaku_jyoko | 9:9e72c0ff2759 | 5 | #include "graphics.h" |
kaku_jyoko | 9:9e72c0ff2759 | 6 | |
kaku_jyoko | 9:9e72c0ff2759 | 7 | C12832_LCD lcd; |
kaku_jyoko | 9:9e72c0ff2759 | 8 | |
kaku_jyoko | 9:9e72c0ff2759 | 9 | int main() |
kaku_jyoko | 9:9e72c0ff2759 | 10 | { |
kaku_jyoko | 9:9e72c0ff2759 | 11 | int i,s; |
kaku_jyoko | 9:9e72c0ff2759 | 12 | lcd.cls(); |
kaku_jyoko | 9:9e72c0ff2759 | 13 | lcd.set_font((unsigned char*) Arial_9); |
kaku_jyoko | 9:9e72c0ff2759 | 14 | s = 3; |
kaku_jyoko | 9:9e72c0ff2759 | 15 | lcd.print_bm(bitmTree,95,0); // print chistmas tree |
kaku_jyoko | 9:9e72c0ff2759 | 16 | lcd.copy_to_lcd(); |
kaku_jyoko | 9:9e72c0ff2759 | 17 | lcd.setmode(XOR); // XOR - a second print will erase |
kaku_jyoko | 9:9e72c0ff2759 | 18 | for(i = -15; i < 75; ){ |
kaku_jyoko | 9:9e72c0ff2759 | 19 | lcd.print_bm(bitmSan1,i,2); |
kaku_jyoko | 9:9e72c0ff2759 | 20 | wait(0.05); |
kaku_jyoko | 9:9e72c0ff2759 | 21 | lcd.copy_to_lcd(); // update lcd |
kaku_jyoko | 9:9e72c0ff2759 | 22 | lcd.print_bm(bitmSan1,i,2); // erase |
kaku_jyoko | 9:9e72c0ff2759 | 23 | i= i+s; |
kaku_jyoko | 9:9e72c0ff2759 | 24 | lcd.print_bm(bitmSan2,i,2); // print next |
kaku_jyoko | 9:9e72c0ff2759 | 25 | wait(0.05); |
kaku_jyoko | 9:9e72c0ff2759 | 26 | lcd.copy_to_lcd(); // update lcd |
kaku_jyoko | 9:9e72c0ff2759 | 27 | lcd.print_bm(bitmSan2,i,2); // erase |
kaku_jyoko | 9:9e72c0ff2759 | 28 | i= i+s; |
kaku_jyoko | 9:9e72c0ff2759 | 29 | lcd.print_bm(bitmSan3,i,2); // print next |
kaku_jyoko | 9:9e72c0ff2759 | 30 | wait(0.05); |
kaku_jyoko | 9:9e72c0ff2759 | 31 | lcd.copy_to_lcd(); // update lcd |
kaku_jyoko | 9:9e72c0ff2759 | 32 | lcd.print_bm(bitmSan3,i,2); // erase |
kaku_jyoko | 9:9e72c0ff2759 | 33 | i= i+s; |
kaku_jyoko | 9:9e72c0ff2759 | 34 | } |
kaku_jyoko | 9:9e72c0ff2759 | 35 | lcd.print_bm(bitmSan3,i,2); |
kaku_jyoko | 9:9e72c0ff2759 | 36 | lcd.set_auto_up(0); |
kaku_jyoko | 9:9e72c0ff2759 | 37 | //こんにちは |
kaku_jyoko | 9:9e72c0ff2759 | 38 | for(i=-20; i<5; i++){ // scrolling text |
kaku_jyoko | 9:9e72c0ff2759 | 39 | lcd.locate(5,i); |
kaku_jyoko | 9:9e72c0ff2759 | 40 | lcd.printf("Happy"); |
kaku_jyoko | 9:9e72c0ff2759 | 41 | lcd.locate(5,i+12); |
kaku_jyoko | 9:9e72c0ff2759 | 42 | lcd.printf("Christmas"); |
kaku_jyoko | 9:9e72c0ff2759 | 43 | lcd.copy_to_lcd(); |
kaku_jyoko | 9:9e72c0ff2759 | 44 | lcd.locate(5,i); |
kaku_jyoko | 9:9e72c0ff2759 | 45 | //wait(0.002); |
kaku_jyoko | 9:9e72c0ff2759 | 46 | //こんにちは |
kaku_jyoko | 9:9e72c0ff2759 | 47 | lcd.printf("Happy"); |
kaku_jyoko | 9:9e72c0ff2759 | 48 | lcd.locate(5,i+12); |
kaku_jyoko | 9:9e72c0ff2759 | 49 | lcd.printf("Christmas"); |
kaku_jyoko | 9:9e72c0ff2759 | 50 | lcd.copy_to_lcd(); |
kaku_jyoko | 9:9e72c0ff2759 | 51 | i=i+1; |
kaku_jyoko | 9:9e72c0ff2759 | 52 | } |
kaku_jyoko | 9:9e72c0ff2759 | 53 | lcd.locate(5,i); |
kaku_jyoko | 9:9e72c0ff2759 | 54 | lcd.printf("Happy"); |
kaku_jyoko | 9:9e72c0ff2759 | 55 | lcd.locate(5,i+12); |
kaku_jyoko | 9:9e72c0ff2759 | 56 | lcd.printf("Christmas"); |
kaku_jyoko | 9:9e72c0ff2759 | 57 | lcd.copy_to_lcd(); |
kaku_jyoko | 9:9e72c0ff2759 | 58 | |
kaku_jyoko | 9:9e72c0ff2759 | 59 | } |