Simple LCD scrolling text for 16 character LCD display.

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 
00002 
00003 #include "mbed.h"
00004 #include "TextLCD.h"
00005 
00006 TextLCD lcd(p24, p25, p26, p27, p28, p29, p30); // rs, rw, e, d0, d1, d2, d3
00007 
00008 const char *message = "                Hello there mousie!";
00009 
00010 int main() {
00011     //lcd.printf("Yay! Woo! from  Rainycat!");
00012     while (1) {
00013     int i;
00014     for (i = 0; message[i]; i++) {
00015         lcd.locate(0,0);
00016         int j, k = i;
00017         for (j = 0; j < 15; j++) {
00018             if (message[k+j]) {
00019                 lcd.putc(message[k+j]);
00020             } else {
00021                 lcd.putc(' ');
00022                 k--;
00023             }
00024         }
00025         wait_ms(450);
00026     }    
00027     }
00028 }