0
\$\begingroup\$

I am trying to reverse engineer the project from this video: https://youtu.be/zc1zbwheyE0?t=50s. From the video a visible 10 wires are going from the LEDs to the Arduino mega, i am assuming that they are wired in a 5x5 matrix (5 rows, 5 columns) given that there are 25 keys on the Midi controller so there most be 25 LEDs. i reconstructed the project the best a could from observing the video, but my issue is when i press 3 keys 5 LEDs light up unlike in the original video where 3 keys are pressed and 3 LEDs light up(as seen @ 0:50 of the video). This is the issue i am having : http://imgur.com/a/9SOEJ. i am thinking the issue is related to how i have my LEDs wired, but my LEDs are wired exactly the same as in the video. isn't it ? is there something i might have missed? How is the project in the video able to light up 3 LEDs without having an issue with extra LEDs lighting up in their matrix? how can i fix my circuit to replicate the video? here is some of my coed for turning on an LED when a key is pressed:

include MIDI.h>
MIDI_CREATE_DEFAULT_INSTANCE();
byte anodes[5] = {30, 32, 34, 36,38};
byte cathodes[5] = {31, 33, 35, 37,39};
byte data1 = 0;

void setPinTo5V(byte pin) //set a pin given to this function to a 5V voltage source
{
pinMode(pin, OUTPUT);
digitalWrite(pin, HIGH);
}

void setPinToGND(byte pin) //set a pin given to this function to a GROUND (GND pin)
{
pinMode(pin, OUTPUT);
digitalWrite(pin, LOW);
}

void loop() {
MIDI.read();
}

void MyHandleNoteOn(byte channel, byte pitch, byte velocity)
{
data1 = MIDI.getData1();
if (data1==48){//C3
setPinTo5V(anodes[0]);//set pin 30 to 5V
setPinToGND(cathodes[0]);//set pin 31 to GND
delay(1); //do nothing for 1 ms
}

//this is done for all 25 keys any help would be appreciated Thanks.

\$\endgroup\$

marked as duplicate by Dave Tweed Oct 14 '18 at 14:11

This question was marked as an exact duplicate of an existing question.

0
\$\begingroup\$

A circuit diagram of what vyou thing you are doing and a 1st check your eyes :-).
You have 6 LEDs lit,not 5, which is MUCH easier to explain.
The two adjacent groups appear to be being driven in parallel.
ie if keys are on columns 1,3,5 then rows 1 & 2 are connected, either in code or on the circuit board.

With only 10 wires and 25 LEDs you have 5 columns and 5 row drives.
LEDS 1-5, 6-10, 11-15, ... are connected to columns 1 2 3 4 5 repeatedly and row connections are.
Row 1 = LEDS 1 6 11 16 ...
Row 2 = LEDS 2 7 12 17 ...
... Row 5 = LEDS 5 10 15 ...

I should have looked at picture 1 first. Your basic connections look correct as above.

There may be no "N Key rollover issue as the LEDs ARE the diodes you need to stop NKR.

Sounds like software.

Trouble shooting hardware.

Activate 1 row-column at a time using the 10 wires driving at the connection point to the microcontroller.

C 1 2 3 4 5 one at a time with R1 should give a sequence of the 1st 5 LEDs.
Same with C 1 2 3 4 5 and Row 2.
Then try several R or C at once to see how it should behave.


Glances at code - not obvious how pin by pin is set.
Why is limit 48?
= 72_10?

\$\endgroup\$

Not the answer you're looking for? Browse other questions tagged or ask your own question.