working multi line scoller message on lcd

Dependencies:   mbed C12832_lcd

Files at this revision

API Documentation at this revision

Comitter:
andrewbw01
Date:
Wed Mar 03 14:24:49 2021 +0000
Commit message:
working multi line scrolling message on LCD

Changed in this revision

C12832_lcd.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/C12832_lcd.lib	Wed Mar 03 14:24:49 2021 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/dreschpe/code/C12832_lcd/#8f86576007d6
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Mar 03 14:24:49 2021 +0000
@@ -0,0 +1,94 @@
+#include "mbed.h"
+#include "C12832_lcd.h"
+
+C12832_LCD lcd;             // create lcd object
+
+char welcome_str1[] ="**********";
+char welcome_str2[] =" Welcome  ";
+char welcome_str3[] ="**********";
+
+int vert_line_hight = 9;
+
+void scroll_msg_right(void);                // fuction prototypes
+void scroll_msg_left(void); 
+
+
+int main()
+{
+    scroll_msg_right();
+    wait(0.1);
+    scroll_msg_left();
+    
+    while(1)
+    {}
+}
+
+
+
+// scroll message right
+void scroll_msg_right(void)
+{
+    for(int i=10; i>0; i--)             // scroll one character on at a time
+    {
+        lcd.cls();
+        lcd.locate(0,0);
+        lcd.printf("%s", (welcome_str1+i));
+        
+        lcd.locate(0, vert_line_hight);
+        lcd.printf("%s", (welcome_str2+i));
+        
+        lcd.locate(0, vert_line_hight*2);
+        lcd.printf("%s", (welcome_str3+i));
+        
+        wait(0.2); 
+    }
+    
+    for(int i=0; i<45; i++)                     // scroll message
+    {
+        lcd.cls();
+        lcd.locate(i,0);
+        lcd.printf("%s", welcome_str1);
+        
+        lcd.locate(i, vert_line_hight);
+        lcd.printf("%s",  welcome_str2);
+        
+        lcd.locate(i, vert_line_hight*2);
+        lcd.printf("%s", welcome_str3);
+        
+        wait(0.075);
+    }
+}
+         
+        
+void scroll_msg_left(void)
+{
+    for(int i=45; i>0; i--)
+    {
+        lcd.cls();
+        lcd.locate(i,0);
+        lcd.printf("%s", welcome_str1);
+        
+        lcd.locate(i, vert_line_hight);
+        lcd.printf("%s", welcome_str2);
+        
+        lcd.locate(i, vert_line_hight*2);
+        lcd.printf("%s", welcome_str3);
+        
+        wait(0.075);
+    }
+    
+    for(int i=0; i<11; i++)             // scroll one character on at a time
+    {
+        lcd.cls();
+        lcd.locate(0,0);
+        lcd.printf("%s", (welcome_str1+i));
+        
+        lcd.locate(0, vert_line_hight);
+        lcd.printf("%s", (welcome_str2+i));
+        
+        lcd.locate(0, vert_line_hight*2);
+        lcd.printf("%s", (welcome_str3+i));
+        
+        wait(0.2); 
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Wed Mar 03 14:24:49 2021 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400
\ No newline at end of file