This is a 16x2 LCD Keypad module for ARDUINO / Arduino Diecimila Duemilanove / FREEDUINO board.
Blue Backlight with white words
Uses 4 Bit Arduino LCD Library
The Modified LCD4Bit library and Schematic will send by email.
GP2D12 ranging code:
#include
LCD4Bit_mod lcd = LCD4Bit_mod(2);
char GP2D12;
char a,b;
char str1[]="Renge:";
char str2[]=" Renge Over ";
char str3[]="cm";
void setup()
{
lcd.init();
lcd.clear();
lcd.printIn("GP2D12 testing...");
}
void loop()
{
GP2D12=read_gp2d12_range(1);
if(GP2D12>80||GP2D12<10)
{
lcd.cursorTo(2,0);
lcd.printIn(str2);
}
else
{
a=0x30+GP2D12/10;
b=0x30+GP2D12%10;
lcd.cursorTo(2, 3);
lcd.printIn(str1);
lcd.print(a);
lcd.print(b);
lcd.printIn(str3);
}
delay(50);
}
float read_gp2d12_range(byte pin)
{
int tmp;
tmp = analogRead(pin);
if (tmp < 3)return -1;
return (6787.0 /((float)tmp - 3.0)) - 4.0;
}
Pin Connections:
| Pin | Function |
| Digital 4 | DB4 |
| Digital 5 | DB5 |
| Digital 6 | DB6 |
| Digital 7 | DB7 |
| Digital 8 | RS (Data or Signal Display Selection) |
| Digital 9 | Enable |
| Digital 10 |
Backlit Control
Pin used:
Please refer to the second image above.
Installing library:
Download and unzipped the library folder, and place it to the Arduino libraries directory. Once the library is correctly installed, the file structcture should look like:
arduino-0010/hardware/libraries/LCD4Bit_mod
arduino-0010/hardware/libraries/LCD4Bit_mod/LCD4Bit_mod.cpp
arduino-0010/hardware/libraries/LCD4Bit_mod/LCD4Bit_mod.h
arduino-0010/hardware/libraries/LCD4Bit_mod/keywords.txt
arduino-0010/hardware/libraries/LCD4Bit_mod/examples
arduino-0010/hardware/libraries/LCD4Bit_mod/readme.txt
Open the example from file -> Examples -> LDC4Bit_mod -> LCD4Bit_modExample, as shown in the screenshot above (third image).
The example should provide enough information to show you how to work with the LCD and all the 5 buttons.
Schematics download:
Package Includes