digitalelements
Active member
Hi folks,
Just wondering if this bit of code can/should use more arrays ? Or, does it need to be this way to retain separate Note numbers and thresholds per
input. I'm using Teensy 4.0 and FSRs for my input for MIDI over USB.
Thanks!
Just wondering if this bit of code can/should use more arrays ? Or, does it need to be this way to retain separate Note numbers and thresholds per
input. I'm using Teensy 4.0 and FSRs for my input for MIDI over USB.
Thanks!
Code:
#include "MIDIcontroller.h"
byte MIDIchannel = 10;
const int pressPin [10] = {A0,A1,A2,A3,A4,A5,A6,A7,A8,A9}; // ANALOG pin
// Pin & Note number
MIDIdrum Pad0(A0, 36);
MIDIdrum Pad1(A1, 37);
MIDIdrum Pad2(A2, 38);
MIDIdrum Pad3(A3, 39);
MIDIdrum Pad4(A4, 40);
MIDIdrum Pad5(A5, 41);
MIDIdrum Pad6(A6, 42);
MIDIdrum Pad7(A7, 43);
MIDIdrum Pad8(A8, 44);
MIDIdrum Pad9(A9, 45);
void setup(){
// Threshold
Pad0.setThreshold(30);
Pad1.setThreshold(30);
Pad2.setThreshold(30);
Pad3.setThreshold(30);
Pad4.setThreshold(30);
Pad5.setThreshold(30);
Pad6.setThreshold(30);
Pad7.setThreshold(30);
Pad8.setThreshold(30);
Pad9.setThreshold(30);
}
void loop(){
Pad0.send();
Pad1.send();
Pad2.send();
Pad3.send();
Pad4.send();
Pad5.send();
Pad6.send();
Pad7.send();
Pad8.send();
Pad9.send();
// Crash Protection
while(usbMIDI.read()){}
}