// RGB and R, G, B LED demo
#include <LiquidCrystal_I2C.h>

#define I2C_ADDR    0x27
#define LCD_COLUMNS 20
#define LCD_LINES   4

LiquidCrystal_I2C lcd(I2C_ADDR, LCD_COLUMNS, LCD_LINES);

const int pinR = 3;
const int pinG = 5;
const int pinB = 6;

const int potR = A0;
const int potG = A1;
const int potB = A2;

void setup() {
  pinMode(pinR, OUTPUT);
  pinMode(pinG, OUTPUT);
  pinMode(pinB, OUTPUT);
  pinMode(potR, INPUT);
  pinMode(potG, INPUT);
  pinMode(potB, INPUT);
    lcd.init();
 lcd.backlight();

 
  
}

int readPot(int pin) {
  return map(analogRead(pin), 0, 1023, 0, 255);
}

void loop() {
  analogWrite(pinR, readPot(potR));
  analogWrite(pinG, readPot(potG));
  analogWrite(pinB, readPot(potB));
  lcd.setCursor(0, 0);
  lcd.print("R:");
 lcd.print(int(readPot(potR)));

  lcd.print(" G:");
   lcd.print(readPot(potG));

  lcd.print(" B:");
   lcd.println(readPot(potB));


  }