Created
January 23, 2018 22:12
-
-
Save omiq/328d2a7dca0b27c5c98f853fd083fb29 to your computer and use it in GitHub Desktop.
Grove i2c LCD with random backlight colour
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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