This sketch prints "Hello World!" to the LCD and uses the scrollDisplayLeft() and scrollDisplayRight() methods to scroll the text.

Dependencies:   Hotboards_SpiLcd mbed

Files at this revision

API Documentation at this revision

Comitter:
Hotboards
Date:
Tue Feb 02 22:17:34 2016 +0000
Commit message:
First release: Hotboards_SpiLcd_Scroll

Changed in this revision

Hotboards_SpiLcd.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
diff -r 000000000000 -r bd5a3c76e81f Hotboards_SpiLcd.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Hotboards_SpiLcd.lib	Tue Feb 02 22:17:34 2016 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/users/Hotboards/code/Hotboards_SpiLcd/#b777b6147d99
diff -r 000000000000 -r bd5a3c76e81f main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Feb 02 22:17:34 2016 +0000
@@ -0,0 +1,82 @@
+/*
+  LiquidCrystal Library - scrollDisplayLeft() and scrollDisplayRight()
+ Demonstrates the use a 16x2 LCD display.  The Hotboards_SpiLcd
+ library works with all LCD displays that are compatible with the
+ ST7032 driver presented on Spi Lcd board (http://www.hotboards.org).
+ This sketch prints "Hello World!" to the LCD and uses the
+ scrollDisplayLeft() and scrollDisplayRight() methods to scroll
+ the text.
+  The circuit:
+  *  BKL   -->  GND
+  *  VDD   -->  3.3v
+  *  GND   -->  GND
+  *  SCK   -->  PA_5
+  *  SI    -->  PA_6
+  *  CS    -->  PB_15
+  *  RS    -->  PB_14
+  *  RST   -->  PB_13
+ Library and example ported by Diego from Hotboards and originally created 
+ by David A. Mellis
+ library modified 5 Jul 2009
+ by Limor Fried (http://www.ladyada.net)
+ example added 9 Jul 2009
+ by Tom Igoe
+ modified 22 Nov 2010
+ by Tom Igoe
+ */
+
+#include "mbed.h"
+#include "Hotboards_SpiLcd.h"
+
+/* initialize an instance of SPI bus,setting the SPI pins*/
+SPI device(PA_7,PA_6,PA_5); /* SO, SI, SCK*/
+/* initialize the library with the numbers of the interface pins*/
+Hotboards_SpiLcd display( device, PB_15, PB_14, PB_13 ); /* SPI, CS, RS, RST */
+
+
+int main() 
+{
+    /* set the spi frequency to 5MHz*/
+    device.frequency(5000000);
+    /* initialize internal lcd controller:*/
+    display.init();
+    // Print a message to the LCD.
+    display.printf("hello, world!");
+    wait(1);
+    
+    while(1) 
+    {
+      // scroll 13 positions (string length) to the left
+      // to move it offscreen left:
+      for (int positionCounter = 0; positionCounter < 13; positionCounter++) 
+      {
+        // scroll one position left:
+        display.scrollDisplayLeft();
+        // wait a bit:
+        wait(0.2);
+      }
+
+      // scroll 29 positions (string length + display length) to the right
+      // to move it offscreen right:
+      for (int positionCounter = 0; positionCounter < 29; positionCounter++) 
+      {
+        // scroll one position right:
+        display.scrollDisplayRight();
+        // wait a bit:
+        wait(0.2);
+      }
+
+      // scroll 16 positions (display length + string length) to the left
+      // to move it back to center:
+      for (int positionCounter = 0; positionCounter < 16; positionCounter++) 
+      {
+       // scroll one position left:
+       display.scrollDisplayLeft();
+       // wait a bit:
+       wait(0.2);
+      }
+      
+      // delay at the end of the full loop:
+     wait(1);
+   }
+}
diff -r 000000000000 -r bd5a3c76e81f mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Feb 02 22:17:34 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/6f327212ef96
\ No newline at end of file