Hello world for lpclcd module https://strawberry-linux.com/catalog/items?code=12014

Dependencies:   I2cLCD mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 //
00002 // for strawberry-linux.com's "lpclcd" 11U24 Board
00003 // https://strawberry-linux.com/catalog/items?code=12014
00004 //
00005 #include "mbed.h"
00006 #include "I2cLCD.h"
00007 
00008 // SW,LED,PULLUP
00009 // P0_1  : USER SW (ISP)
00010 // P0_6  : LED
00011 // P0_23 : I2C PULLUP
00012 
00013 //
00014 // I2C LCD SlaveAddress = 0x7c 
00015 //  SlaveAddress , commands and the initialize sequence are almost 
00016 //  same as "i2c low voltage lcd module" by strawberry-linux. 
00017 //  (http://strawberry-linux.com/catalog/items?code=27001)
00018 //
00019 //  So I2cLCD library seems to work well.
00020 //
00021 // P0_25 : RESET
00022 // P0_4  : SCL
00023 // P0_5  : SDA
00024 // P1_3  : LCD BACKLIGHT
00025 //
00026 
00027 DigitalIn sw(P0_1);
00028 DigitalOut backlight(P1_3);
00029 DigitalOut led(P1_6); // The manual says "P0_6" but schematic is "P1_6"
00030 I2cLCD lcd(P0_5, P0_4,P0_25);
00031 Ticker timer;
00032 
00033 int count = 0 ;
00034 
00035 void attime()
00036 {
00037     lcd.locate(0,0);
00038     lcd.printf("Hello World! %d\r\n",count);
00039     led = !led;
00040     count++ ;
00041 } 
00042 
00043 int main() 
00044 {
00045     backlight = 0;
00046     timer.attach(&attime, 1);
00047     while(1)
00048     {
00049     }
00050 }