Is this Arduino example wrong or is it me.

Hope this is in the right forum this time.

I,m a newbie to all this programming so still learning, been looking and examining codes with the Arduino software the examples like this one File/examples/LiquidCrystal/helloworld in this code this line looks wrong:
lcd.begin(16, 2);
Surely it should be:
lcd.begin(12, 2);
But im a newbie and this is only my second day at it so maybe Wrong.

This is the code:
// 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);
// Print a message to the LCD.
lcd.print(“hello, world!”);

The 16 in the LCD.begin call is the numer of characters per line, not some pin. How many you have depends on your display. Just for the reference, the 2 is the number of lines on the display.


lcd.begin(16,2); says the lcd display is 16 characters wide and has 2 lines. If you have another display you might need lcd.begin(20,4);

The code displayed is not complete. So does it run?

Yep that makes complete sense now. I fully understand. Thanks

Try it with 12,2. You should find that four character spaces on one end of the display are inaccessible and remain blank forever.