Go Down

Topic: Question on LCD display example "HelloWorld" in arduino. (Read 635 times) previous topic - next topic

yaantey

Hey guys,
I would like to know if I need to change or insert any new command to the example "HelloWorld" in arduino to display in two lines if i am using 16x2 lcd display. Also what is the command or how can I move the message on display so that its in the center.

Thanks. Im just learning so im pretty new to this.


PaulS

Quote
change the (0)

That's not very helpful advice, when there are two 0s in the statement. Which one should be changed?

OP:
Change one 0 to something else, like 1. Observe the results. Then, change it back to 0, and change the other 0 to 1. Observe the results. Now, you know which argument affects the row and which affects the column.

Use that knowledge to put text where you want on the LCD.

AWOL

If you want to centre the text, first call strlen on the string you want to display.
This will give the number of characters in the string, and allow you do some simple arithmetic to enable you to put the cursor in the right place before printing the string.
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Nick Gammon

Look inside LiquidCrystal.cpp. See what the arguments are:

Code: [Select]
void LiquidCrystal::setCursor(uint8_t col, uint8_t row)

The first one is clearly the column (ie. left to right) and the second one is the row (top to bottom).
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

Go Up