Go Down

Topic: Sort-out the incorrect "help" in the Arduino 0022 tutorials (Read 1 time) previous topic - next topic


I only started playing with Arduino a couple of weeks ago, so the IDE I downloaded should be up-to-date.  Last week I bought an LCD + keypad Shield (DFRobot - brand) , plugged it in, went into C:\Program Files\Arduino\arduino-0022\libraries\LiquidCrystal\examples.

NOTHING worked.  Not a single one of the b****tards.  Oh 'bother' I've bought a dud LCD Shield.

By pure chance I looked at some online examples and noticed the pin numbers were different
From Cursor.pde in the library:
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
Which does not work.  And all the examples have the same pin-allocation.

From wherever it was, online:
// select the pins used on the LCD panel
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);
Which works as sweet as you like.

My nearest approach to an LCD screen has been on the mobile phone, so it was to say the least, discouraging that the examples on which I depend, in the authoritative Library are just wrong.



Be aware that some of the libraries are not writen for a single shield, the are written for a group of components.
This is why you should always check if the product you bought has the correct pin layout for the example, or adjust the code according to your component(s).

Do not copy, paste and run!
Do then at least a copy ,paste, check and run



Rather than blindly connecting things up and expecting them to work, try to understand how they work :)
If you tak esome time to understand what the numbers mean in the function LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
and you had the circuit diagram for the hardware you have, then you'll have a better understanding of why the numbers do not match the hardware you have.
At least hopefully, from this mistake, you have learned something of the software and hardware you are experimenting with. :)



If you tak esome time to understand what the numbers mean in the function LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

Most beginners go to the Arduino LiquidCrystal tutorial (http://arduino.cc/en/Tutorial/LiquidCrystal) when they start working with their LCD.  That tutorial does not adequately explain the relationship between those numbers and the circuit connections.  See my reply #2 in this thread (http://arduino.cc/forum/index.php/topic,78228.msg590805.html#msg590805) for more on this topic.


Go Up