From 370e2086848d40b3ae942bc7d5963da4092ac19f Mon Sep 17 00:00:00 2001 From: Nathan Bookham Date: Sun, 26 May 2013 15:32:32 +0200 Subject: [PATCH 1/2] Update CustomCharacter.ino Fixed incompatibility with newer Arduino software and updated documentation. Centered custom character animation for a 16x2 display and updated link for character generator as previous link is dead. --- .../CustomCharacter/CustomCharacter.ino | 27 ++++++++++--------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/libraries/LiquidCrystal/examples/CustomCharacter/CustomCharacter.ino b/libraries/LiquidCrystal/examples/CustomCharacter/CustomCharacter.ino index d3ce479246d..8c680b6db18 100644 --- a/libraries/LiquidCrystal/examples/CustomCharacter/CustomCharacter.ino +++ b/libraries/LiquidCrystal/examples/CustomCharacter/CustomCharacter.ino @@ -1,13 +1,14 @@ /* LiquidCrystal Library - Custom Characters - Demonstrates how to add custom characters on an LCD display. + Demonstrates how to add custom characters on an LCD display. The LiquidCrystal library works with all LCD displays that are compatible with the Hitachi HD44780 driver. There are many of them out there, and you can usually tell them by the 16-pin interface. + This example uses a 16x2 LCD display, but the code can be easily adapted for different sized displays. This sketch prints "I Arduino!" and a little dancing man - to the LCD. + to the LCD. Attaching a potentiometer to Analog pin 0 will allow you to control the speed of the dancing man. The circuit: * LCD RS pin to digital pin 12 @@ -17,21 +18,23 @@ * LCD D6 pin to digital pin 3 * LCD D7 pin to digital pin 2 * LCD R/W pin to ground - * 10K potentiometer: - * ends to +5V and ground - * wiper to LCD VO pin (pin 3) - * 10K poterntiometer on pin A0 + * 10K potentiometer: ends to +5V and ground, wiper to LCD VO pin (pin 3) + * Another 10K potentiometer on pin A0 (Optional) - created21 Mar 2011 + created 21 Mar 2011 by Tom Igoe Based on Adafruit's example at https://github.com/adafruit/SPI_VFD/blob/master/examples/createChar/createChar.pde + updated 26 May 2013 + by Nathan Bookham + Fixed incompatibility with newer Arduino software and updated documentation. Centered custom character animation for a 16x2 display and updated link for character generator as previous link is dead. + This example code is in the public domain. http://www.arduino.cc/en/Tutorial/LiquidCrystal Also useful: - http://icontexto.com/charactercreator/ + http://mikeyancey.com/hamcalc/lcd_characters.php (code is buggy - just copy the custom character values. */ @@ -112,9 +115,9 @@ void setup() { lcd.begin(16, 2); // Print a message to the lcd. lcd.print("I "); - lcd.write(0); + lcd.write((byte)0); lcd.print(" Arduino! "); - lcd.write(1); + lcd.write((byte)1); } @@ -124,11 +127,11 @@ void loop() { // map the result to 200 - 1000: int delayTime = map(sensorReading, 0, 1023, 200, 1000); // set the cursor to the bottom row, 5th position: - lcd.setCursor(4, 1); + lcd.setCursor(7, 1); // draw the little man, arms down: lcd.write(3); delay(delayTime); - lcd.setCursor(4, 1); + lcd.setCursor(7, 1); // draw him arms up: lcd.write(4); delay(delayTime); From 20bf2c7d4dd1c567409d56b62dcb43165f6a58c7 Mon Sep 17 00:00:00 2001 From: Nathan Bookham Date: Sun, 26 May 2013 18:22:23 +0200 Subject: [PATCH 2/2] Update CustomCharacter.ino Centered line 0 text. --- .../LiquidCrystal/examples/CustomCharacter/CustomCharacter.ino | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libraries/LiquidCrystal/examples/CustomCharacter/CustomCharacter.ino b/libraries/LiquidCrystal/examples/CustomCharacter/CustomCharacter.ino index 8c680b6db18..3d8cfb6111a 100644 --- a/libraries/LiquidCrystal/examples/CustomCharacter/CustomCharacter.ino +++ b/libraries/LiquidCrystal/examples/CustomCharacter/CustomCharacter.ino @@ -19,7 +19,7 @@ * LCD D7 pin to digital pin 2 * LCD R/W pin to ground * 10K potentiometer: ends to +5V and ground, wiper to LCD VO pin (pin 3) - * Another 10K potentiometer on pin A0 (Optional) + * Another 10K potentiometer with wiper connected to pin analog pin 0 (Optional) created 21 Mar 2011 by Tom Igoe @@ -114,6 +114,7 @@ void setup() { // set up the lcd's number of columns and rows: lcd.begin(16, 2); // Print a message to the lcd. + lcd.setCursor(1, 0); lcd.print("I "); lcd.write((byte)0); lcd.print(" Arduino! ");