arduino 4x4 button matrix sequencer issues

preview_player
Показать описание
some errors in my code are making the sqeuencer continue to change the note.

what should happen is easch time a button is pressed a variable is incremented by 1 in a range of 0 - 8. each increment is a different note.

desired effect is. when I turn the sequencer on it play a tone for every step, there are 8 if the represented by the columns on the 8x8 led matrix.
each time I click a button, (I have one mapped to each step) the note should increment by one (I have an array holding all of the notes)
this is represented by the rows.

as you can see the note keeps incrementing untill I press another button.

another weird thing is the timing of when a button press is recorded. it seems I have to press it in at right time for it to register, it's like it's only scanning for button presses once a loop.

sketch (i hope the code is readable enough!)
Рекомендации по теме