Carlos Torres / Mbed 2 deprecated PCD8544_LCD

Dependencies:   mbed pcd8544_drv

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 /* ********************************************
00002 * PCD8544 Driver
00003 * This is a sample program to interface the
00004 * mbed microcontroller to an LCD with an PCD8544
00005 * driver using the pcd8544_drv library.
00006 *
00007 * Created on: 12/31/2010 at 19:48
00008 * Created by: CarlosFTM
00009 ********************************************** */
00010 
00011 
00012 #include "mbed.h"
00013 #include "pcd8544_drv.hpp"
00014 
00015 DigitalOut myled(LED1);
00016 
00017 int main()
00018 {
00019   /* Create a LCD interface*/
00020   pcd8544 lcd(p21, p22, p23, p24, p27);
00021 
00022   /* Initialize LCD & Clear screen*/
00023   lcd.resetLCD();
00024   lcd.initLCD();
00025   lcd.clearLCD();
00026   wait(0.5);
00027 
00028   /* Fill the screen with a single character (14 * 6 = 84 characters) */
00029   char count;
00030   for (count = 0; count < (MAX_CHAR_X * MAX_CHAR_Y); count++)
00031   {
00032     lcd.writeChar('#');
00033   }
00034 
00035   /* Locate the cursor on line 3 and print a char string */
00036   char message[] = ">PCD8544 LCD>";   // Define message string
00037   char* message_p = message;         // Create a pointer
00038   
00039   lcd.setCursorXY(1,2);              // Locate the cursor on line 3
00040                                      // (Line/Column count starts at 0)
00041   
00042   lcd.writeString(message_p);        // Write the string on the LCD
00043   
00044   /* Flash LED
00045    * in infinite loop
00046    */
00047   while(1)
00048   {
00049     myled = !myled;
00050     wait(0.05);
00051     myled = !myled;
00052     wait(0.5);
00053   }
00054 }