Hey everyone,
Me and a friend are trying to connect a piano keyboard to the arduino.
We came as far to connecting a light directly with the breadboard and that works, but we now have to decode the signals the keyboard sends.
We are using a matrix with 6 rows and 5 collums. The problem is that we have to find a way to see what buttons we press. We only have 12 digital slots on the arduino uno, so the tip we got was to change the current on the collums one by one and then we can see what row is beeing used.. But we dont really know how to get a current to all the Collums with the arduino uno.
Code so far(we know its not good at all but its all we tried and all we understand a little ;))
#include <Keypad.h>
const int ledPin = 2;
int var1 = 0;
int var2 = 0;
int octbegin = 0;
int octeind = 1;
int octaaf = 0;
const byte rows = 6; //6 rows
const byte cols = 5; //5 columns
char keys[rows][cols] = {
{'1','2','3','4','5'},
{'6','7','8','9','10'},
{'11','12','13','14','15'},
{'16','17','18','19','20'},
{'21','22','23','24','25'},
{'26','27','28','29','30'}
};
byte rowPins[rows] = {8, 7, 6, 5, 4, 3}; //connect to the row pinouts of the keypad
byte colPins[cols] = {13, 12, 11, 10, 9}; //connect to the column pinouts of the keypad
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, rows, cols );
#define ledpin 13
void setup()
{
Serial.begin(9600);
pinMode(buttonPin, INPUT);
pinMode(ledPin, OUTPUT);
digitalWrite(ledPin, LOW);
}
void loop()
{
char key = keypad.getKey();
if(key) // Check for a valid key.
{
switch (key)
{
case '1':
Serial.println("test");
digitalWrite(ledPin, HIGH);
}
}
for (var1 = 0; var1 < 2; var1++;)
{
digitalwrite(var1)
octaaf = 63;
if (var1 = octbegin)
{
octaaf = octaaf * 64;
}
}
Serial.print(octaaf)