#include <LiquidCrystal.h>
#include <Wire.h>
#define REDLITE 3
#define GREENLITE 5
#define BLUELITE 6
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);
// you can change the overall brightness by range 0 -> 255
int brightness = 255;
void setup() {
// set up the LCD's number of rows and columns:
lcd.begin(16, 2);
// Print a message to the LCD.
lcd.print("RGB 16x2 Display ");
lcd.setCursor(0,1);
lcd.print(" Multicolor LCD ");
brightness = 100;
}
void loop() {
setBacklight(0, 0, 255);
delay(5);
}
void setBacklight(uint8_t r, uint8_t g, uint8_t b) {
b = map(b, 0, 255, 0, brightness);
b = map(b, 0, 255, 255, 0);
Serial.print(" B = "); Serial.println(b, DEC);
analogWrite(BLUELITE, b);
}