View Single Post
Old 03-08-13, 12:29 PM   #64
AC_Hacker
Supreme EcoRenovator
 
AC_Hacker's Avatar
 
Join Date: Mar 2009
Location: Portland, OR
Posts: 4,004
Thanks: 303
Thanked 723 Times in 534 Posts
Default Progress with LCD Display...

Before the temperature/humidity sensors came in, I was trying to get the LCD display running on the Arduino.

There's are good tutorials everywhere with libraries & sketches, and this morning I discovered that the Arduino IDE had LCD libraries & a sample sketch already installed on my computer. Things are really getting convenient.


I didn't want to solder to the LCD, so I used a flat cable and made a breakout board that had a socket strip that gave me the ability to prototype in a similar manner to the setup on my proto-board.

So the task was to download a data sheet for my LCD and make a connection scheme, so that I could make adjustments for the differences between the Arduino pinout and the Teensy pinout.

Here's the sketch I found in the Arduino IDE Library file "LiquidCrystal", with the changes I made to suit the Teensy:

Code:
/*
  LiquidCrystal Library - Hello World
 
 Demonstrates the use a 16x2 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 sketch prints "Hello World!" to the LCD 
 and shows the time. CHANGED TO SUIT 8 CHARACTER DISPLAY
 
  The circuit:
 * LCD RS pin to digital pin 12      -> 5  CHANGED
 * LCD Enable pin to digital pin 11  -> 4   CHANGED
 * LCD D4 pin to digital pin 5       ->23  CHANGED
 * LCD D5 pin to digital pin 4       ->22  CHANGED
 * LCD D6 pin to digital pin 3       ->21  CHANGED
 * LCD D7 pin to digital pin 2       ->20  CHANGED
 * LCD R/W pin to ground
 * 10K resistor:
 * ends to +5V and ground
 * wiper to LCD VO pin (pin 3)
 
 Library originally added 18 Apr 2008
 by David A. Mellis
 library modified 5 Jul 2009
 by Limor Fried (http://www.ladyada.net)
 example added 9 Jul 2009
 by Tom Igoe
 modified 22 Nov 2010
 by Tom Igoe
 
 This example code is in the public domain.

 http://www.arduino.cc/en/Tutorial/LiquidCrystal
 */

// include the library code:
#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins CHANGED TO SUIT TEENSY
LiquidCrystal lcd(5, 4, 23, 22, 21, 20);

void setup() {
  // set up the LCD's number of columns and rows: CHANGED TO SUIT 8 CHAR DISPLAY
  lcd.begin(8, 2);
  // Print a message to the LCD.
  lcd.print("ACHacker");
}

void loop() {
  // set the cursor to column 0, line 1
  // (note: line 1 is the second row, since counting begins with 0):
  lcd.setCursor(0, 1);
  // print the number of seconds since reset:
  lcd.print(millis()/1000);
}
Ran first time... no issues.


Life is good.

Best,

-AC
Attached Images
  
__________________
I'm not an HVAC technician. In fact, I'm barely even a hacker...

Last edited by AC_Hacker; 03-08-13 at 12:32 PM..
AC_Hacker is offline   Reply With Quote