Hello!
Baite ROBOT Drive the future (if I can read) is the shield I have, turns up in many google image searches, but there is no pinouts for smaller arduinos, as nano3, for which the shield part is of no use.
(I've been notified that I did not identified the shield - my bad - thank you!). There is an annotated pic of the shield.
Spent some 24h in total internet digging time to find the pinouts for the above blue LCD key pad shield.
Did not found anything, so using the LiquidCrystal() and a buzzing multimeter figured out this:
Upper connectors (bellow inscription LCD Keypad Shield), named J1 (left) and J2 (right), viewed from LCD part, counting left to right:
(I hope I can attach the pictures this time)
/*
J1-1 -
J1-2 - RW
J1-3 -
J1-4 -
J1-5 -
J1-6 -
J1-7 - E
J1-8 - RS
J2-1 - D7
J2-2 - D6
J2-3 - D5
J2-4 - D4
J2-5 -
J2-6 -
J2-7 -
J2-8 -
Connected like this:
Arduino - LCD shield
D7 ------ J2-1 - D7
D6 ------ J2-2 - D6
D5 ------ J2-3 - D5
D4 ------ J2-4 - D4
D10 ----- J1-2 - RW
D9 ------ J1-7 - E
D8 ------ J1-8 - RS
Then added another wire from A0 (maked so on the shield, below LCD, right) to nano3's A0
Arduino - LCD shield
A0 ------ A0
to be able to use the buttons too, while I am here.
defined lcd:
LiquidCrystal lcd(8, 10, 9, 4, 5, 6, 7); // specifically for the above setup
LiquidCrystal() break it down like this:
LiquidCrystal(rs, rw, enable, d4, d5, d6, d7) / these should be the nano3's pins
then used used this example to test the buttons and display the tested button:
(sorry, been through so many pages in these 24h that I do not know where I did copy this from - this is not mine, I just added the pinouts for the first 2 connectors, above LCD)
/*
J1-1 -
J1-2 - RW
J1-3 -
J1-4 -
J1-5 -
J1-6 -
J1-7 - E
J1-8 - RS
J2-1 - D7
J2-2 - D6
J2-3 - D5
J2-4 - D4
J2-5 -
J2-6 -
J2-7 -
J2-8 -
*/
/*
The circuit:
* LCD RS pin to digital pin 8
* LCD Enable pin to digital pin 9
* LCD D4 pin to digital pin 4
* LCD D5 pin to digital pin 5
* LCD D6 pin to digital pin 6
* LCD D7 pin to digital pin 7
* LCD BL pin to digital pin 10
* KEY pin to analogl pin 0
*/
#include <LiquidCrystal.h>
LiquidCrystal lcd(8, 10, 9, 4, 5, 6, 7);
char msgs[5][16] = {"Right Key OK ",
"Up Key OK ",
"Down Key OK ",
"Left Key OK ",
"Select Key OK" };
int adc_key_val[5] ={50, 200, 400, 600, 800 };
int NUM_KEYS = 5;
int adc_key_in;
int key=-1;
int oldkey=-1;
void setup()
{
lcd.clear();
lcd.begin(16, 2);
lcd.setCursor(0,0);
lcd.print("ADC key testing");
}
void loop()
{
adc_key_in = analogRead(0); // read the value from the sensor
key = get_key(adc_key_in); // convert into key press
if (key != oldkey) // if keypress is detected
{
delay(50); // wait for debounce time
adc_key_in = analogRead(0); // read the value from the sensor
key = get_key(adc_key_in); // convert into key press
if (key != oldkey)
{
lcd.setCursor(0, 1);
oldkey = key;
if (key >=0){
lcd.print(msgs[key]);
}
}
}
delay(100);
}
// Convert ADC value to key number
int get_key(unsigned int input)
{
int k;
for (k = 0; k < NUM_KEYS; k++)
{
if (input < adc_key_val[k])
{
return k;
}
}
if (k >= NUM_KEYS)k = -1; // No valid key pressed
return k;
}
And there! It works, I can display whatever I want!




