Wednesday, June 12, 2013

Trouble with the 16x2 #LCD on my #arduino project

Using the wiring diagram that was included on the eBay listing for the LCD panel, I proceeded to wire it up. It appeared that I simply needed the following:
Pin Connection Description
1 +5 Volts +5 Volts
2 GND Ground
3 -- vadj - Adjust (contrast?)
4 C/D Command/Data (RS?)
5 R/W Re/Write
6 E Chip Enable
7 D0 Data
8 D1 Data
9 D2 Data
10 D3 Data
11 D4 Data
12 D5 Data
13 D6 Data
14 D7 Data

The red wire, despite the color, appears to be a ground. The red color, to me, made me think it was +5 volts, but when I looked where it was soldered, which was to the metal housing around the display, I concluded it must be ground. I decided that, for now, I need not connect this since I am providing ground to pin 2. The code, too, looks pretty straight forward. I had to include the "LiquidCrystal" library:
     #include <LiquidCrystal.h>

I created an object for the LCD:
     LiquidCrystal lcd(11,7,5,4,3,2);

This created my lcd object telling the library that pin 11 was rs, 7 was enable, and 5-2 were data 4-7. In the setup() function, I specified the display size of 16x2:
     lcd.begin(16,2);

Then I merely wanted to display "Welcome." Again, in the setup() function, I added:
     lcd.print("Welcome");

Compile, upload, nothing. The LCD didn't flicker, nothing. The rest of the project still functioned, the LEDs began their march back and forth and the interrupt worked when I pressed the button.

As usual, I'm left with a mystery. Did I wire it wrong? Did I code it wrong? Is the part defective? Unlike when I started working with the shift register, I don't have a spare and a replacement is a LONG boat ride away unless I want to pay a premium price.

The thing is, yes, for this game I need a display, but my longer term goals don't really require it. But it will be incredibly helpful when working with other shields to be able to display values returned.

One of those longer term goals is going to quickly become more immediate. A few weeks back I joined the Western PA Robotics Competition, WestPARC, group. Last night was the first meeting. Unfortunately, we were unable to attend because last night was also my son's last baseball game of the season and my daughter's last softball game, neither of which we could really miss. I did see a brief update of the meeting though and it described the first competition. It is a simple one, but will require that I fast-forward my work if I want to participate. The description:
For those who couldn't make it: we've settled on a 
straight-forward first contest: your bot will be placed 
some semi-random distance from a wall, and will be 
given a maximum time limit to approach the wall as 
close as possible without touching it.  How hard can it 
be, right?  :)

I'm sure Eric will have a rule-filled write-up soon, 
and we can start talking specifics about the first 
contest.  As for me, it's down to the basement to heat 
up the soldering iron.
Considering that I've not made anything move beyond rotating a servo, I need to get going. Need to figure out how to use that Ultrasonic Module HC-SR04 Distance Measuring Transducer Sensor that I bought.

No comments:

Post a Comment