This sketch demonstrates the use of the autoscroll() and noAutoscroll() functions to make new text scroll or not.
Dependencies: Hotboards_SpiLcd mbed
Revision 0:272f1d80b7d0, committed 2016-02-02
- Comitter:
- Hotboards
- Date:
- Tue Feb 02 21:15:21 2016 +0000
- Commit message:
- Firts release: Hotboards_SpiLcd_AutoScroll
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Hotboards_SpiLcd.lib Tue Feb 02 21:15:21 2016 +0000 @@ -0,0 +1,1 @@ +https://developer.mbed.org/users/Hotboards/code/Hotboards_SpiLcd/#b777b6147d99
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Tue Feb 02 21:15:21 2016 +0000
@@ -0,0 +1,75 @@
+/*
+ LiquidCrystal Library - Autoscroll
+ 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 demonstrates the use of the autoscroll()
+ and noAutoscroll() functions to make new text scroll or not.
+ The circuit:
+ 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
+ This example code is in the public domain.
+ */
+
+#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();
+
+ while(1)
+ {
+ // set the cursor to (0,0):
+ display.setCursor(0, 0);
+ // print from 0 to 9:
+ for(int thisChar = 0; thisChar < 10; thisChar++)
+ {
+ display.printf("%d",thisChar);
+ wait(0.5);
+ }
+
+ // set the cursor to (16,1):
+ display.setCursor(16, 1);
+ // set the display to automatically scroll:
+ display.autoscroll();
+ // print from 0 to 9:
+ for (int thisChar = 0; thisChar < 10; thisChar++)
+ {
+ display.printf("%d",thisChar);
+ wait(0.5);
+ }
+ // turn off automatic scrolling
+ display.noAutoscroll();
+
+ // clear screen for the next loop:
+ display.clear();
+ // reset the display shift for the next loop
+ display.home();
+ }
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue Feb 02 21:15:21 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/6f327212ef96 \ No newline at end of file