Monday, January 9, 2012

Arduino 2x16 LCD display.

I have just refined my code for the first LCD exercise down to this;

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

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup() {
  // set up the LCD's number of columns and rows:
  lcd.begin(16, 2);
}
void loop() {

  lcd.setCursor(3, 0);
  lcd.print("Hello world");
  delay(1000);
  lcd.clear();
  delay(1000);
  lcd.setCursor(3, 1);
  lcd.print("Hello Russ");
  delay(1000);
  lcd.clear();
  delay(1000);
  }

Fairly simple stuff, my input in blue, just looks good on the display.

The circuit is also slightly different from most of the published designs, I have also laid it out to be somewhat clearer than them. The use of colour is for information purposes and is not compulsory although the red and black for the power and ground rails is fairly important. The display is a lie! The code would never produce this, I just rewrote it to show positions.

No comments:

Post a Comment

Please add your comments here. We check most days and all suitable comments will be published.

Kardoma:

fills the stage with flags!
Free counters!