Anschluss ? Kein Problem einfach im Sandwichverfahren. Ich bin ein Hardwaremensch und habe mal einen Blick auf den Schaltplan geworfen. Das Display ist direkt mit den Anschlüssen des Arduino verbunden. Die Pinbelegung kann nicht verändert werden.
Die Anschlüsse ergeben diesen Programmanfang.
#include <LiquidCrystal.h>
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);
Ein Blick auf die Schaltung der Taster verrät: Hier greifen 5 Taster verschiedene Spannungen von einer Widerstandsreihe ab die zu Analogpin0 führt.
Das Musterprogramm wertet lediglich die Werte des Analog/Digitalwandlers aus.
Hier das Programm mit dem ich getestet habe :
// Arduino code for using the 1602 LCD Keypad shield
// Please feel free to copy, edit, distribute, sell, plagiarise ... Whatever you want :)
// A mention of Babelduck Cybernetics would be nice but is not necessary
// Written January 2012
//#include // Use the standard library
#include <LiquidCrystal.h>
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);
void setup()
{
lcd.begin(16, 2); // set up the LCD's number of columns and rows
lcd.print("hello world"); // Print hello world to the first line
pinMode(10, OUTPUT); // Set up pin 10 for the backlight control
pinMode(0, INPUT); // Set up pin 0 to read the keypad
}
void loop()
{
analogWrite(10, 50); // Hellig der Beleuchtung einstellen (10 , 20) bis (10 , 255)
int keyPad=analogRead(0); // Read the value from keypad
lcd.setCursor(0, 1); // Set the cursor to column 0, line 1
lcd.print(keyPad); // Print the key pad value to the second line
}
Ich werde in kürze noch ein Beispiel mit Libary zeigen mit dem sich die Tasten eleganter auswerten lassen.