Grove - LCD RGBBacklight
Done with tedious mono color backlight? This Grove enables you to set the color to whatever you like via the simple and concise Grove interface. It takes I2C as communication method with your microcontroller. So number of pins required for data exchange and backlight control shrinks from ~10 to 2, relieving IOs for other challenging tasks. Besides, Grove - LCD RGB Backlight supports user-defined characters. Want to get a love heart or some other foreign characters? Just take advantage of this feature and design it!
This product is a replacement of Grove - Serial LCD. If you are looking for primitive 16x2 LCD modules, we have green yellow backlight version and blue backlight version on sale also.
Hardware Required
- Intel® Edison Module
- Arduino* expansion board
- Grove Base Shield v2
- Grove LCD RGB Backlight
Circuit
Schematic
Code
#include <Wire.h>
#include "rgb_lcd.h"
rgb_lcd lcd;
int colorR = 255;
int colorG = 0;
int colorB = 0;
void setup()
{
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
lcd.setRGB(colorR, colorG, colorB);
// Print a message to the LCD.
lcd.print("Stopwatch!");
delay(1000);
}
unsigned long milliseconds;
int milli = 0;
int seconds;
int minutes;
int hours;
// display
// "00:00:00.00"
// XX:XX:XX:.xx
char chBuff[11];
void loop()
{
milliseconds = millis();
if (milli > 99)
milli = 0;
seconds = (int) (milliseconds / 1000) % 60 ;
minutes = (int) ((milliseconds / (1000*60)) % 60);
hours = (int) ((milliseconds / (1000*60*60)) % 24);
// set the cursor to column 0, line 1
// (note: line 1 is the second row, since counting begins with 0):
sprintf(chBuff, "%02d:%02d:%02d.%02d", hours, minutes, seconds, milli);
lcd.setCursor(0, 1);
lcd.print(chBuff);
delay(10);
milli++;
}
See Also
Reference sites
'IoT > Intel Edison' 카테고리의 다른 글
Grove - Touch & Relay (0) | 2015.02.21 |
---|---|
Grove – Servo (0) | 2015.02.14 |
Grove – Rotary Angle Sensor (0) | 2015.01.24 |
Grove - Sound Sensor (0) | 2015.01.24 |
Grove - Buzzer (0) | 2015.01.24 |