SparkFun SerLCD v2.5 controller; Copied from the Arduino.cc SerLCD library; http://playground.arduino.cc/Code/SerLCD

Dependents:   ForEhab Serial_HelloWorld_Mbed ForOfek

Fork of LCDSerial by Robert Ellis

Test Code

#include "mbed.h"
#include "SerialLCD.h"

SerialLCD lcd(PTC4);

uint8_t smiley[8] = {
    0x00,
    0x11,
    0x00,
    0x00,
    0x11,
    0x0E,
    0x00
};

int main() {
    lcd.clear();
    
    while(true) {
        /// Test code ///
        lcd.clearLine(1);
        lcd.printf("Full Bright Test");
        lcd.setBrightness(30);
        wait(3);
        
        lcd.clearLine(1);
        lcd.printf("Blink Test");
        lcd.setCursor(2, 1);
        lcd.printf("Blinking");
        lcd.blink();
        wait(3);
        
        lcd.clearLine(1);
        lcd.printf("Clear Test");
        wait(2);
        lcd.clear();
        wait(3);
        
        lcd.clearLine(1);
        lcd.printf("New Char Test");
        lcd.setCursor(2, 1);
        lcd.createChar(1, smiley);
        lcd.printCustomChar(1);
        wait(3);
        
        lcd.clearLine(1);
        lcd.printf("Cursor Test");
        lcd.setCursor(2, 1);
        lcd.cursor();
        wait(3);
        
        lcd.clearLine(1);
        lcd.printf("Display Test");
        lcd.noDisplay();
        wait(2);
        lcd.display();
        wait(3);
        
        lcd.clearLine(1);
        lcd.printf("Home Test");
        lcd.setCursor(2, 1);
        lcd.home();
        lcd.printf("Got home");
        wait(3);
        
        lcd.leftToRight();
        lcd.clearLine(1);
        lcd.printf("LeftToRight Test");
        wait(3);
        
        lcd.clearLine(1);
        lcd.printf("noBlink Test");
        lcd.setCursor(2, 1);
        lcd.noBlink();
        wait(3);
        
        lcd.clearLine(1);
        lcd.printf("noCursor Test");
        lcd.setCursor(2, 1);
        lcd.noCursor();
        wait(3);
        
        lcd.rightToLeft();
        lcd.clearLine(1);
        lcd.printf("rightToLeft Test");
        wait(3);
        
        lcd.clearLine(1);
        lcd.printf("Half Bright Test");
        lcd.setBrightness(15);
        wait(3);
    }
}
Revision:
0:df5850d83ee5
Child:
1:96f055419f71
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SerialLCD.h	Sun Feb 13 15:16:20 2011 +0000
@@ -0,0 +1,57 @@
+#ifndef SerialLCD_h
+#define SerialLCD_h
+
+#include "mbed.h"
+
+#define LCD_WIDTH 16
+#define LCD_BAUD 9600
+
+/**
+ * SparkFun SerLCD v2.5 Controller
+ */
+class SerialLCD : public Serial
+{
+  public:
+  
+    /**
+     * Constructor.
+     * @param tx Connected to rx pin of LCD
+     * @param rx Not connected but needs to be specified for serial interface.
+     */
+    SerialLCD(PinName tx, PinName rx);
+    
+    /**
+     * Clear the LCD.
+     */
+    void clear();
+    
+    /**
+     * Set backlight brightness;
+     */
+    void setBacklight(int brightness);
+    
+    /**
+     * Set cursor position.
+     */
+    void setPosition(int row, int col);
+    
+    /**
+     * Make LCD text visible or invisible.
+     */
+    void setVisible(bool visible);
+    
+    /**
+     * Start scrolling to the left.
+     */
+    void scrollLeft();
+    
+    /**
+     * Start scrolling to the right.
+     */
+    void scrollRight();
+    
+    
+};
+
+
+#endif