Anag vision LCD + Arduino

Filed under Arduino

Has been a while since I made a proper post, so thought it was about time to get something done!
I have recently been playing with Arduino – got a nice arduino DUE, a gyro system (they both deserve one post probably…) and an LCD display.

The LCD display was a standard LCD, 16 characters, 1 row, model ANAG VISION AV1611YFBY-WJ, on top “1601L Rev.B”:

LCDOff
LDCModel

Once sorted out all connections…
overview

I uploaded the code on my nice Arduino DUE using the example 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, 1);
lcd.print(“Hello World!”);
}

void loop() {

}

This is where I got the disappointment…

Hello

It was impossible to actually print the whole string… String was getting cut after 8 chars.
Since the display is 16 digits, cutting the string at the 8th character does not strike me immediately as an issue of the library…
How about, the LCD has actually two rows of 8 chars (although we can see only one)?
Strangely enough, changing the lcd.begin() to 8 columns, 2 rows did not make a difference.

HelloWorld

Indeed, the solution was to use two rows – but the only way to do the trick was to move the cursor to the second row! Fortunately Arduino’s string manipulation really came in helpful! If anybody needs the code, here it is:
#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:

}

void printOnDisp(String toWrite) {
lcd.begin(8, 2);
lcd.print(toWrite.substring(0,8));
lcd.setCursor(0, 1);
lcd.print(toWrite.substring(8,15));
}

void loop() {
printOnDisp(“Hello,world!”);
}

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*


× nine = 81