It was TOO easy :-)
I had bought 10 rows of 40 Header Pins on eBay, (so called, but actually various odds & sods of shorter lengths of pins) so soldered 2 rows of 7 pins into the LM038
I had also bought some 40 pin Dupont Male to Female Ribbon Cable (Jumper Wires)
I found this very helpful page:
http://www.m0yom.co.uk/index.php/blog/34-general/62-using-the-hitachi-lm038-lcd-with-the-arduino
tried it, and it worked. TOO easy... BUT... What's with his insane pin order?
It was a bit fraught hooking it up!
I noticed that the initialisation in the start of his code was in the same order as his twisted wiring instructions, so I thought I'd try re-ordering the pins in a more sane manner & seeing if changing the initialisation string to match would work too... of course it did! :-)
So now I have:
LCD Pin | Arduino Pin |
1 | GND |
2 | +5V |
3 | GND via Resistor for contrast control |
4 | 2 |
5 | 3 |
6 | 4 |
7 | 5 (Optional) |
8 | 6 (Optional) |
9 | 7 (Optional) |
10 | 8 (Optional) |
11 | 9 |
12 | 10 |
13 | 11 |
14 | 12 |
And I changed my code to:
#include <LiquidCrystal.h>
/*
* LiquidCrystal display with:
* LCD 4 (RS) to Arduino pin 2
* LCD 5 (R/W) to Arduino pin 3
* LCD 6 (E) to Arduino pin 4
*/
LiquidCrystal lcd(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12);
void setup()
{
// Print a message to the LCD.
lcd.print("hello, world!");
}
void loop()
{
}
No comments:
Post a Comment