Skip to content
Permalink
Browse files

use remaining 5 digital pins for leds

  • Loading branch information...
J0J0 T
J0J0 T committed Nov 17, 2018
1 parent 1f7ab8f commit 58210e59dabe624c4fe28c8a071a0a85428c7f11
Showing with 13 additions and 0 deletions.
  1. +13 −0 matrixmidi.ino
@@ -20,6 +20,7 @@ uint8_t buttons[4][3] = {
{107,108,109},
{110,111,112},
};
uint8_t ledPins[] = {1,2,3,4,5};

MIDI_CREATE_INSTANCE(HardwareSerial, USBserial, MIDI); // with this method port is selectable here

@@ -36,6 +37,10 @@ void setup()
digitalWrite(outPins[0], HIGH); // initialize cols with HIGH, matrix should work low-active
digitalWrite(outPins[1], HIGH);
digitalWrite(outPins[2], HIGH);
for (uint8_t ledset = 1; ledset <= sizeof(ledPins); ledset++)
{
pinMode(ledPins[ledset], OUTPUT);
}
while(!USBserial); // wait until USBserial is accessible
if (mode == 0)
{
@@ -77,6 +82,10 @@ uint8_t buttonsPressedLast[4][3] = {
void sendCCandLog(uint8_t cc_num, uint8_t cc_value, uint8_t _midi_ch, uint8_t _mode)
{
digitalWrite(ledPin, HIGH);
for (uint8_t led = 1; led <= sizeof(ledPins); led++)
{
digitalWrite(ledPins[led], HIGH);
}
aSerial.vvv().p("button CC: ").pln(cc_num);
aSerial.vvv().pln();
if (mode != 2)
@@ -122,4 +131,8 @@ void loop()
}
//delay(500); // enable for slower debugging
digitalWrite(ledPin, LOW);
for (uint8_t ledoff = 1; ledoff <= sizeof(ledPins); ledoff++)
{
digitalWrite(ledPins[ledoff], LOW);
}
}

0 comments on commit 58210e5

Please sign in to comment.
You can’t perform that action at this time.