Hey there,
i have a problem with my Arduino program. It doesn't work with more than one digit in the char variable.
Is it possible to make it work in this configuration?
Thanks for the help.
Ps.: It's an project for school where we have to build an piano with 31 buttons.
#include <Keypad.h>
//Hier wird die größe des Keypads definiert
const byte COLS = 5; //5 Spalten
const byte ROWS = 8; //8 Zeilen
//Die Ziffern/Zeichen:
const
char hexaKeys[ROWS][COLS]={
{'Cis3', 'C3', '-', 'Cis1', 'E2'},
{'D3', 'H2', '-', 'D1', 'Dis2'},
{'Dis3', 'B2', '-', 'Dis1', 'D2'},
{'E3', 'A2', '-', 'E1', 'Cis2'},
{'F3', 'Gis2', '-', 'F1', 'C2'},
{'-', 'G2', '-', 'Fis1', 'H1'},
{'-', 'Fis2', 'H0', 'G1', 'B1'},
{'-', 'F2', 'C1', 'Gis1', 'A1'}
};
byte colPins[COLS] = { 8, 7, 6 }; //Definition der Pins für die 3 Spalten
byte rowPins[ROWS] = { 5, 4, 3, 2 };//Definition der Pins für die 4 Zeilen
char Taste; //pressedKey entspricht in Zukunft den gedrückten Tasten
Keypad Tastenfeld = Keypad(makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS); //Das Keypad kann absofort mit myKeypad angesprochen werden
void setup() {
Serial.begin(9600);
}
void loop() {
Taste = Tastenfeld.getKey(); //pressedKey entspricht der gedrückten Taste
if (Taste) { //Wenn eine Taste gedrückt wurde
Serial.print("Die Taste ");
Serial.print(Taste);
Serial.print("wurde gedrueckt");
Serial.println(); //Teile uns am Serial Monitor die gedrückte Taste mit
}
}