Skip to content

Commit

Permalink
add program change on usb
Browse files Browse the repository at this point in the history
  • Loading branch information
okyeron committed Feb 9, 2023
1 parent 50dba8f commit 7a3eefd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 4 additions & 2 deletions hachi-ni-firmware/hachi-ni-firmware.ino
Original file line number Diff line number Diff line change
Expand Up @@ -92,21 +92,23 @@ void leftButtonCallback(void* s) {
// Serial.println((char*)s);
activeBank--;
activeBank = constrain(activeBank, 0, numBanks-1);
USBMIDI.sendProgramChange(activeBank, 1);
pixelsOff();
pixels.setPixelColor(activeBank+1, 128, 0, 0); // bank pixels are 1-8 not 0-7
pixels.show();
Serial.println(activeBank);
// Serial.println(activeBank);
}

void rightButtonCallback(void* s) {
// Serial.print("Right: ");
// Serial.println((char*)s);
activeBank++;
activeBank = constrain(activeBank, 0, numBanks-1);
USBMIDI.sendProgramChange(activeBank, 1);
pixelsOff();
pixels.setPixelColor(activeBank+1, 128, 0, 0);
pixels.show();
Serial.println(activeBank);
// Serial.println(activeBank);
}


Expand Down
5 changes: 5 additions & 0 deletions webconfig/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,11 @@
// console.log('cntrl: '+ cntrl(event.data) + ":"+ cntrlvalue(event.data));
controller( cntrl(event.data), cntrlvalue(event.data) );
}
if (type(event.data) == 192){ // program change
// console.log('pgchange: '+ cntrl(event.data));
// get config
midiDevice.output.send(raw("F0 7D 00 00 1F F7"));
}
}, timeout);

port.send(identify);
Expand Down

0 comments on commit 7a3eefd

Please sign in to comment.