How to use command codes for serial backpack back lighted RGB LCD [SOLVED]

Hey…
I’m trying to Set the background color to red with a “USB + Serial Backpack Kit with 16x2 RGB backlight positive LCD” that I got from adafruit… item 872…

How do I use the command codes 0xFE 0xD0 in a sketch to set background color?? How to I represent R G B values…an example would be awesome…

lcd.write(0xFE);
lcd.write(0xD0);
what comes next here???

whats the format for the color selection?? what comes next?? If someone can help me with the format…i’d be thankful!!!

Thanks Eric

I don't know that product from Adafruit. Can you post a link to the product page?

https://www.adafruit.com/product/782

they have a sketch example of a fading background the goes through all colors but I couldn't figure out how to modify to get a static color like say red as the background

Thanks

Eric

Eric, do you have this module attached to the PC through an USB cable, or you have an Arduino controlling it?

I have the arduino uno on pin 2 controlling it

You have an example in the page of Adafruit:

#include <SoftwareSerial.h>


// Create a software serial port!
SoftwareSerial lcd = SoftwareSerial(0, 2);

void setup() {
  lcd.begin(9600);
  // set the size of the display if it isn't 16x2 (you only have to do this once)
  lcd.write(0xFE);
  lcd.write(0xD1);
  lcd.write(16); // 16 columns
  lcd.write(2); // 2 rows
  delay(10);
  // we suggest putting delays after each command to make sure the data
  // is sent and the LCD is updated.

  // set the contrast, 200 is a good place to start, adjust as desired
  lcd.write(0xFE);
  lcd.write(0x50);
  lcd.write(200);
  delay(10);
  // set the brightness - we'll max it (255 is max brightness)
  lcd.write(0xFE);
  lcd.write(0x99);
  lcd.write(255);
  delay(10);
  // turn off cursors
  lcd.write(0xFE);
  lcd.write(0x4B);
  lcd.write(0xFE);
  lcd.write(0x54);
  // create a custom character
  lcd.write(0xFE);
  lcd.write(0x4E);
  lcd.write((uint8_t)0); // location #0
  lcd.write((uint8_t)0x00); // 8 bytes of character data
  lcd.write(0x0A);
  lcd.write(0x15);
  lcd.write(0x11);
  lcd.write(0x11);
  lcd.write(0x0A);
  lcd.write(0x04);
  lcd.write((uint8_t)0x00);
  delay(10); // we suggest putting delays after each command
  // clear screen
  lcd.write(0xFE);
  lcd.write(0x58);
  delay(10); // we suggest putting delays after each command
  // go 'home'
  lcd.write(0xFE);
  lcd.write(0x48);
  delay(10); // we suggest putting delays after each command

  lcd.print("We ");
  lcd.write((uint8_t)0); // to print the custom character, 'write' the location
  lcd.println(" Arduino!");
  lcd.print(" - Adafruit");
  delay(1000);
}

uint8_t red, green, blue;
void loop() {
  // adjust colors
  for (red = 0; red < 255; red++) {
    lcd.write(0xFE);
    lcd.write(0xD0);
    lcd.write(red);
    lcd.write((uint8_t)0);
    lcd.write(255 - red);
    delay(10); // give it some time to adjust the backlight!
  }

  for (green = 0; green < 255; green++) {
    lcd.write(0xFE);
    lcd.write(0xD0);
    lcd.write(255 - green);
    lcd.write(green);
    lcd.write((uint8_t)0);
    delay(10); // give it some time to adjust the backlight!
  }

  for (blue = 0; blue < 255; blue++) {
    lcd.write(0xFE);
    lcd.write(0xD0);
    lcd.write((uint8_t)0);
    lcd.write(255 - blue);
    lcd.write(blue);
    delay(10); // give it some time to adjust the backlight!
  }
}

And you have the description of de commands in the next page:

From your question I believe that is all you need.

I see the two commands but how do I format the 0-255 values for rgb??

lcd.write(0xFE); lcd.write(0xD0); what comes next here?? I'm not sure how to format the code for color value??

I'm new at codeing if you could give an example for this I'd appreciate it!!!

Eric

Next goes 3 .write one for each color, I believe.

If you write in the end of setup() function something, like:

    lcd.write(0xFE);
    lcd.write(0xD0);
    lcd.write((uint8_t)255);
    lcd.write((uint8_t)0);
    lcd.write((uint8_t)0);
    delay(10);
  }

And delete all the code from the loop() function, I believe that the LCD will show the backlight red.

THAT"S IT

THANK YOU!!!

it worked...now that I see the code written it makes sense to me...I couldn't figure how to represent the R G B values

You're awesome. it help me tremendously! Now I can get on with my project! :grin:

Eric