I have a button matrix set up and when a button is pressed, I want to light up a corresponding LED. I've seen numerous ways of doing this in the library, but the issue I'm having is that I'm using an SX1509 I/O expander so I can't use the NoteToLed library or anything. I was wondering if it's possible to define in the arduino file what happens when a button is pressed. For example, something like this possibly:
for (int i = 0; i < buttonMatrixRows; i++) {
for (int j = 0; j < buttonMatrixCols; j++) {
if (buttonMatrix[i][j].currentState != buttonMatrix[i][j].previousState) {
if (buttonMatrix[i][j] == LOW) {
//Light up LED & whatnot
} else {
//Disable LED
}
}
{
}