Skip to content

Instantly share code, notes, and snippets.

@omiq
Created January 23, 2018 22:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save omiq/328d2a7dca0b27c5c98f853fd083fb29 to your computer and use it in GitHub Desktop.
Save omiq/328d2a7dca0b27c5c98f853fd083fb29 to your computer and use it in GitHub Desktop.
Grove i2c LCD with random backlight colour
// libraries for i2c and the specific display
#include <Wire.h>
#include "rgb_lcd.h"
rgb_lcd lcd;
void setup() {
// make sure the random is random
randomSeed(analogRead(0));
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
// Print our message to the LCD.
lcd.print("hello, world!");
}
void loop() {
// Turn off the display:
lcd.noDisplay();
delay(500);
// Turn on the display:
lcd.display();
// Random colours
int colorR = random(255);
int colorG = random(255);
int colorB = random(255);
lcd.setRGB(colorR, colorG, colorB);
delay(500);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment