Hotboards MX / Mbed 2 deprecated Hotboards_SpiLcd_Cursor

Dependencies:   Hotboards_SpiLcd mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 /*
00002   Hotboards_Spilcd Library - Cursor
00003 
00004  Demonstrates the use a 16x2 LCD display.  The Hotboards_SpiLcd
00005  library works with all LCD displays that are compatible with the
00006  ST7032 driver presented on Spi Lcd board (http://www.hotboards.org).
00007  This sketch prints "Hello World!" to the LCD and
00008  uses the cursor()  and noCursor() methods to turn
00009  on and off the cursor.
00010  The circuit:
00011   *  BKL   -->  GND
00012   *  VDD   -->  3.3v
00013   *  GND   -->  GND
00014   *  SCK   -->  PA_5
00015   *  SI    -->  PA_6
00016   *  CS    -->  PB_15
00017   *  RS    -->  PB_14
00018   *  RST   -->  PB_13
00019  Library and example ported by Diego from Hotboards and originally created 
00020  by David A. Mellis
00021  library modified 5 Jul 2009
00022  by Limor Fried (http://www.ladyada.net)
00023  example added 9 Jul 2009
00024  by Tom Igoe
00025  modified 22 Nov 2010
00026  by Tom Igoe
00027  */
00028  
00029 #include "mbed.h"
00030 #include "Hotboards_SpiLcd.h"
00031 
00032 /* initialize an instance of SPI bus,setting the SPI pins*/
00033 SPI device(PA_7,PA_6,PA_5); /* SO, SI, SCK*/
00034 /* initialize the library with the numbers of the interface pins*/
00035 Hotboards_SpiLcd display( device, PB_15, PB_14, PB_13 ); /* SPI, CS, RS, RST */
00036 
00037 
00038 
00039 int main() 
00040 {
00041     /* set the spi frequency to 5MHz*/
00042     device.frequency(5000000);
00043     /* initialize internal lcd controller:*/
00044     display.init();
00045     
00046     // Print a message to the LCD.
00047     display.printf("hello, world!");
00048     
00049     while(1) 
00050     {
00051         // Turn off the cursor:
00052         display.noCursor();
00053         wait(0.5);
00054         // Turn on the cursor:
00055         display.cursor();
00056         wait(0.5);
00057     }
00058 }