Hotboards MX / Mbed 2 deprecated Hotboards_SpiLcd_Blink

Dependencies:   Hotboards_SpiLcd mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

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