Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of Grove_LCD_RGB_Backlight by
Diff: Grove_LCD_RGB_Backlight.h
- Revision:
- 0:253885b1f364
- Child:
- 1:40a3b6506c9f
- Child:
- 3:852b9b565605
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Grove_LCD_RGB_Backlight.h Tue Mar 15 17:19:39 2016 +0000
@@ -0,0 +1,68 @@
+#include "mbed.h"
+
+// I2C addresses for LCD and RGB
+#define LCD_ADDRESS (0x7c)
+#define RGB_ADDRESS (0xc4)
+
+#define RED_REG 0x04
+#define GREEN_REG 0x03
+#define BLUE_REG 0x02
+
+// commands
+#define LCD_CLEARDISPLAY 0x01
+#define LCD_DISPLAYCONTROL 0x08
+#define LCD_FUNCTIONSET 0x20
+
+// flags for display on/off control
+#define LCD_DISPLAYON 0x04
+#define LCD_DISPLAYOFF 0x00
+
+// flag for entry mode
+#define LCD_ENTRYLEFT 0x02
+
+// flags for function set
+#define LCD_8BITMODE 0x10
+#define LCD_2LINE 0x08
+#define LCD_5x10DOTS 0x04
+
+
+class Grove_LCD_RGB_Backlight
+{
+public:
+
+ //Contructor
+ Grove_LCD_RGB_Backlight(PinName sda, PinName scl);
+
+
+
+ //Set RGB Color of backglight
+ void setRGB(char r, char g, char b);
+
+ //Initialize device
+ void init();
+
+ //Turn on display
+ void displayOn();
+
+ //Clear all text from display
+ void clear();
+
+ //Print text to the lcd screen
+ void print(char *str);
+
+ //Move cursor to specified location
+ void locate(char col, char row);
+
+
+private:
+
+ //Send command to display
+ void sendCommand(char value);
+
+ //Set register value
+ void setReg(char addr, char val);
+
+ //MBED I2C object used to transfer data to LCD
+ I2C i2c;
+
+};
\ No newline at end of file
