First, have you used it plugged on top of an arduino yet with success (test as a shield). If not, do that, and show us the sketch you tested it that works (so we can see the pin setup).
jackwp:
First, have you used it plugged on top of an arduino yet with success (test as a shield). If not, do that, and show us the sketch you tested it that works (so we can see the pin setup).
Thanks for your fast response jackwp!
Yes, I did. The sketch is as follows.
Thank you!
#include <LiquidCrystal.h>
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);
int keyPress;
void setup() {
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
// Print a message to the LCD.
lcd.print("hello, world!");
}
void loop() {
keyPress = analogRead(0);
lcd.setCursor(0, 1);
lcd.print("in: ");
lcd.print(keyPress);
lcd.print(" ");
if(keyPress < 65){
lcd.print("Right ");
} else if(keyPress < 221){
lcd.print("Up ");
} else if(keyPress < 395){
lcd.print("Down ");
} else if(keyPress < 602){
lcd.print("Left ");
} else if(keyPress < 873){
lcd.print("Select ");
} else {
lcd.print("No btn");
}
}
I think by read, you mean read the keypad (not read the LCD). The keypad uses the first analog input A0. By using resistors attached to each key, there is a different voltage sent to the one input pin (saves lots of pins that way).
Did that answer your question?