エレキジャック Web版 mbedで初めてのマイコン開発 LCDを極める!でLCDに表示された文字列がスライドするプログラムです。http://www.eleki-jack.com/arm/mbed/cat691/lcd-1/ <5/5>にスライド文字列用のプログラム解説があります。

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
sunifu
Date:
Wed Sep 22 12:52:23 2010 +0000
Commit message:

Changed in this revision

TextLCD.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TextLCD.lib	Wed Sep 22 12:52:23 2010 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/simon/code/TextLCD/#a53b3e2d6f1e
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Sep 22 12:52:23 2010 +0000
@@ -0,0 +1,48 @@
+#include "mbed.h"
+#include "TextLCD.h"
+
+void slideMessage(char* ,double ,int );
+//slideMessage(message, slidetime, row )
+ 
+TextLCD lcd(p24,p26,p27,p28,p29,p30);
+#define SIZE 16
+// I don't test TextLCD 20x ... 16x2B
+
+int main() {
+    char msg[] = "1234567890123456" ;
+    char msg1[] = "Welcome to mbed! mbed is a tool for Rapid Prototyping with Microcontrollers." ;
+    slideMessage(msg1, 0.5,0);
+    return 0 ;
+}
+
+void slideMessage(char msg[], double time,int row)
+{
+    int j, k ;   
+    int len = ( strlen(msg) ) ;
+    
+    lcd.cls();
+ 
+    while(1){        
+        for (j = SIZE -1  ; j>=0 ; j-- ){
+            for ( k = j ; k < SIZE ; k++ ){
+                lcd.locate(k,row);
+                if ( len  > (k - j) )
+                    lcd.printf("%c",msg[k-j]) ;
+                else
+                    lcd.printf(" ") ;
+            }          
+            wait(time) ;
+        }
+ 
+        for ( j = 1 ; j <= len  ; j++ ){
+            for ( k = 0; k < SIZE ; k++ ){
+                lcd.locate(k,row) ;
+                if( ( k + j ) < len )
+                    lcd.printf("%c",msg[k+j]) ;
+                else
+                    lcd.printf(" ") ;
+            }
+            wait(time) ;
+        }    
+    }   
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Wed Sep 22 12:52:23 2010 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/e2ac27c8e93e