1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-07-30 16:24:09 +03:00

Modified LCD custom character example

moved lcd.begin() to the beginnng of the setup() and fixed an issue
that prevented the example from compiling. When calling lcd.write()
with an argument of 0, the 0 must be cast a s a byte.
This commit is contained in:
Scott Fitzgerald
2013-11-11 16:41:12 +04:00
parent 83ef1814cf
commit b332904ee1

View File

@ -22,8 +22,11 @@
* wiper to LCD VO pin (pin 3) * wiper to LCD VO pin (pin 3)
* 10K poterntiometer on pin A0 * 10K poterntiometer on pin A0
created21 Mar 2011 created 21 Mar 2011
by Tom Igoe by Tom Igoe
modified 11 Nov 2013
by Scott Fitzgerald
Based on Adafruit's example at Based on Adafruit's example at
https://github.com/adafruit/SPI_VFD/blob/master/examples/createChar/createChar.pde https://github.com/adafruit/SPI_VFD/blob/master/examples/createChar/createChar.pde
@ -96,7 +99,11 @@ byte armsUp[8] = {
0b00100, 0b00100,
0b01010 0b01010
}; };
void setup() { void setup() {
// initialize LCD and set up the number of columns and rows:
lcd.begin(16, 2);
// create a new character // create a new character
lcd.createChar(0, heart); lcd.createChar(0, heart);
// create a new character // create a new character
@ -108,11 +115,9 @@ void setup() {
// create a new character // create a new character
lcd.createChar(4, armsUp); lcd.createChar(4, armsUp);
// set up the lcd's number of columns and rows:
lcd.begin(16, 2);
// Print a message to the lcd. // Print a message to the lcd.
lcd.print("I "); lcd.print("I ");
lcd.write(0); lcd.write(byte(0)); // when calling lcd.write() '0' must be cast as a byte
lcd.print(" Arduino! "); lcd.print(" Arduino! ");
lcd.write(1); lcd.write(1);
@ -133,6 +138,3 @@ void loop() {
lcd.write(4); lcd.write(4);
delay(delayTime); delay(delayTime);
} }