Skip to content
Permalink
Browse files

Read MIDI messages to avoid lockups.

  • Loading branch information
infovore committed Jan 2, 2019
1 parent dd1401d commit 41fa4a52a96f7d5a32bad2ea882e1b4cb4c2bb1a
Showing with 8 additions and 0 deletions.
  1. +8 −0 firmware/_16n_faderbank_firmware/_16n_faderbank_firmware.ino
@@ -64,6 +64,7 @@ const int muxMapping[16] = { 0,1,2,3,4,5,6,7,15,14,13,12,11,10,9,8 };

// the MIDI write timer
IntervalTimer midiWriteTimer;
IntervalTimer midiReadTimer;
int midiInterval = 5000; // 5ms

// helper values for i2c reading and future expansion
@@ -140,6 +141,7 @@ void setup() {
// turn on the MIDI party
MIDI.begin();
midiWriteTimer.begin(writeMidi, midiInterval);
midiReadTimer.begin(readMidi,midiInterval);

#ifdef LED
pinMode(13, OUTPUT);
@@ -180,6 +182,12 @@ void loop() {
}
}

void readMidi() {
// important to catch inbound MIDI messages even if we do nothiing with them.
MIDI.read();
usbMIDI.read();
}

/*
* The function that writes changes in slider positions out the midi ports
*/

0 comments on commit 41fa4a5

Please sign in to comment.