001 Hello World LCD with Arduino language

1. Forewords

It is the original sample, changed only the pins involved...

2. Setting the board

We must have the following wire connections (don't power your board yet):

Wire  connections
  
 ATmega pins
LCD pins
 Assigned name
 Digital 22
RS
none
 Digital 23
E
none
 Digital 24 A4 none
 Digital 25 A5 none
 Digital 26 A6 none
 Digital 27 A7 none

Now, connect your USB cable, start Arduino 0019 and write the following sketch:

3. The sketch

 /*
 This sketch prints "Hello World!" to the LCD
 and shows the time.
 
  The circuit:
 * LCD RS pin to digital pin 22
 * LCD Enable pin to digital pin 23
 * LCD D4 pin to digital pin 24
 * LCD D5 pin to digital pin 25
 * LCD D6 pin to digital pin 26
 * LCD D7 pin to digital pin 27
 
 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 8 Feb 2010
 by Tom Igoe
 */

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

// initialize the library with the numbers of the interface pins LiquidCrystal lcd(22, 23, 24, 25, 26, 27);

void setup() {
  // set up the LCD's number of columns and rows:   lcd.begin(16, 2);
  // Print a message to the LCD.   lcd.print("hello, world!");
}

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);
}

Upload the sketch.

4. Results

As you can see, I disabled the backlight of the LCD... it is wise to consume less when you connect to USB.

Comments

Translation

Recent site activity