#include <MIDI.h> //library's
#include <Bounce.h>
#include <Wire.h>
#include <Adafruit_PWMServoDriver.h>
#include <Encoder.h>
Adafruit_PWMServoDriver pwm0 = Adafruit_PWMServoDriver(0x40); //I2C devices
Adafruit_PWMServoDriver pwm1 = Adafruit_PWMServoDriver(0x41);
const byte touch0 = 0; //define pins
const byte touch1 = 1;
const byte transmitA = 2;
const byte transmitB = 3;
const byte transmitC = 4;
const byte reciverA = 5;
const byte reciverB = 6;
const byte reciverC = 7;
Encoder Enc0 (8,9);
Encoder Enc1 (10,11);
int led = 13;
const byte button0 = 14;
const byte button1 = 15;
const byte button2 = 16;
const byte button3 = 17;
Encoder Enc2 (12,23);
Encoder Enc3 (24,25);
const byte fader0 = 22;
const byte fader1 = A14;
int i = 0; //verables
char channelnum = 0;
char channelloc = 0;
int fader00 = 0;
int fader01 = 0;
int fader02 = 0;
int fader03 = 0;
int fader04 = 0;
int fader05 = 0;
int fader06 = 0;
int fader07 = 0;
int fader08 = 0;
int fader09 = 0;
int fader10 = 0;
int fader11 = 0;
int fader12 = 0;
int fader13 = 0;
int fader14 = 0;
int newfader00 = 0;
int newfader01 = 0;
int newfader02 = 0;
int newfader03 = 0;
int newfader04 = 0;
int newfader05 = 0;
int newfader06 = 0;
int newfader07 = 0;
int newfader08 = 0;
int newfader09 = 0;
int newfader10 = 0;
int newfader11 = 0;
int newfader12 = 0;
int newfader13 = 0;
int newfader14 = 0;
int touch00 = 0;
int touch01 = 0;
int touch02 = 0;
int touch03 = 0;
int touch04 = 0;
int touch05 = 0;
int touch06 = 0;
int touch07 = 0;
int touch08 = 0;
int touch09 = 0;
int touch10 = 0;
int touch11 = 0;
int touch12 = 0;
int touch13 = 0;
int touch14 = 0;
double faderMax = 1019;
double faderMin = 5;
Bounce b0r0c0 = Bounce(button0,14); //button bounce
Bounce b0r0c1 = Bounce(button0,14);
Bounce b0r0c2 = Bounce(button0,14);
Bounce b0r0c3 = Bounce(button0,14);
Bounce b0r0c4 = Bounce(button0,14);
Bounce b0r0c5 = Bounce(button0,14);
Bounce b0r0c6 = Bounce(button0,14);
Bounce b0r0c7 = Bounce(button0,14);
Bounce b0r1c0 = Bounce(button0,14);
Bounce b0r1c1 = Bounce(button0,14);
Bounce b0r1c2 = Bounce(button0,14);
Bounce b0r1c3 = Bounce(button0,14);
Bounce b0r1c4 = Bounce(button0,14);
Bounce b0r1c5 = Bounce(button0,14);
Bounce b0r1c6 = Bounce(button0,14);
Bounce b0r1c7 = Bounce(button0,14);
Bounce b0r2c0 = Bounce(button0,14);
Bounce b0r2c1 = Bounce(button0,14);
Bounce b0r2c2 = Bounce(button0,14);
Bounce b0r2c3 = Bounce(button0,14);
Bounce b0r2c4 = Bounce(button0,14);
Bounce b0r2c5 = Bounce(button0,14);
Bounce b0r2c6 = Bounce(button0,14);
Bounce b0r2c7 = Bounce(button0,14);
Bounce b0r3c0 = Bounce(button0,14);
Bounce b0r3c1 = Bounce(button0,14);
Bounce b0r3c2 = Bounce(button0,14);
Bounce b0r3c3 = Bounce(button0,14);
Bounce b0r3c4 = Bounce(button0,14);
Bounce b0r3c5 = Bounce(button0,14);
Bounce b0r3c6 = Bounce(button0,14);
Bounce b0r3c7 = Bounce(button0,14);
Bounce b0r4c0 = Bounce(button0,14);
Bounce b0r4c1 = Bounce(button0,14);
Bounce b0r4c2 = Bounce(button0,14);
Bounce b0r4c3 = Bounce(button0,14);
Bounce b0r4c4 = Bounce(button0,14);
Bounce b0r4c5 = Bounce(button0,14);
Bounce b0r4c6 = Bounce(button0,14);
Bounce b0r4c7 = Bounce(button0,14);
Bounce b0r5c0 = Bounce(button0,14);
Bounce b0r5c1 = Bounce(button0,14);
Bounce b0r5c2 = Bounce(button0,14);
Bounce b0r5c3 = Bounce(button0,14);
Bounce b0r5c4 = Bounce(button0,14);
Bounce b0r5c5 = Bounce(button0,14);
Bounce b0r5c6 = Bounce(button0,14);
Bounce b0r5c7 = Bounce(button0,14);
Bounce b0r6c0 = Bounce(button0,14);
Bounce b0r6c1 = Bounce(button0,14);
Bounce b0r6c2 = Bounce(button0,14);
Bounce b0r6c3 = Bounce(button0,14);
Bounce b0r6c4 = Bounce(button0,14);
Bounce b0r6c5 = Bounce(button0,14);
Bounce b0r6c6 = Bounce(button0,14);
Bounce b0r6c7 = Bounce(button0,14);
Bounce b0r7c0 = Bounce(button0,14);
Bounce b0r7c1 = Bounce(button0,14);
Bounce b0r7c2 = Bounce(button0,14);
Bounce b0r7c3 = Bounce(button0,14);
Bounce b0r7c4 = Bounce(button0,14);
Bounce b0r7c5 = Bounce(button0,14);
Bounce b0r7c6 = Bounce(button0,14);
Bounce b0r7c7 = Bounce(button0,14);
Bounce b1r0c0 = Bounce(button1,15);
Bounce b1r0c1 = Bounce(button1,15);
Bounce b1r0c2 = Bounce(button1,15);
Bounce b1r0c3 = Bounce(button1,15);
Bounce b1r0c4 = Bounce(button1,15);
Bounce b1r0c5 = Bounce(button1,15);
Bounce b1r0c6 = Bounce(button1,15);
Bounce b1r0c7 = Bounce(button1,15);
Bounce b1r1c0 = Bounce(button1,15);
Bounce b1r1c1 = Bounce(button1,15);
Bounce b1r1c2 = Bounce(button1,15);
Bounce b1r1c3 = Bounce(button1,15);
Bounce b1r1c4 = Bounce(button1,15);
Bounce b1r1c5 = Bounce(button1,15);
Bounce b1r1c6 = Bounce(button1,15);
Bounce b1r1c7 = Bounce(button1,15);
Bounce b1r2c0 = Bounce(button1,15);
Bounce b1r2c1 = Bounce(button1,15);
Bounce b1r2c2 = Bounce(button1,15);
Bounce b1r2c3 = Bounce(button1,15);
Bounce b1r2c4 = Bounce(button1,15);
Bounce b1r2c5 = Bounce(button1,15);
Bounce b1r2c6 = Bounce(button1,15);
Bounce b1r2c7 = Bounce(button1,15);
Bounce b1r3c0 = Bounce(button1,15);
Bounce b1r3c1 = Bounce(button1,15);
Bounce b1r3c2 = Bounce(button1,15);
Bounce b1r3c3 = Bounce(button1,15);
Bounce b1r3c4 = Bounce(button1,15);
Bounce b1r3c5 = Bounce(button1,15);
Bounce b1r3c6 = Bounce(button1,15);
Bounce b1r3c7 = Bounce(button1,15);
Bounce b1r4c0 = Bounce(button1,15);
Bounce b1r4c1 = Bounce(button1,15);
Bounce b1r4c2 = Bounce(button1,15);
Bounce b1r4c3 = Bounce(button1,15);
Bounce b1r4c4 = Bounce(button1,15);
Bounce b1r4c5 = Bounce(button1,15);
Bounce b1r4c6 = Bounce(button1,15);
Bounce b1r4c7 = Bounce(button1,15);
Bounce b1r5c0 = Bounce(button1,15);
Bounce b1r5c1 = Bounce(button1,15);
Bounce b1r5c2 = Bounce(button1,15);
Bounce b1r5c3 = Bounce(button1,15);
Bounce b1r5c4 = Bounce(button1,15);
Bounce b1r5c5 = Bounce(button1,15);
Bounce b1r5c6 = Bounce(button1,15);
Bounce b1r5c7 = Bounce(button1,15);
Bounce b1r6c0 = Bounce(button1,15);
Bounce b1r6c1 = Bounce(button1,15);
Bounce b1r6c2 = Bounce(button1,15);
Bounce b1r6c3 = Bounce(button1,15);
Bounce b1r6c4 = Bounce(button1,15);
Bounce b1r6c5 = Bounce(button1,15);
Bounce b1r6c6 = Bounce(button1,15);
Bounce b1r6c7 = Bounce(button1,15);
Bounce b1r7c0 = Bounce(button1,15);
Bounce b1r7c1 = Bounce(button1,15);
Bounce b1r7c2 = Bounce(button1,15);
Bounce b1r7c3 = Bounce(button1,15);
Bounce b1r7c4 = Bounce(button1,15);
Bounce b1r7c5 = Bounce(button1,15);
Bounce b1r7c6 = Bounce(button1,15);
Bounce b1r7c7 = Bounce(button1,15);
Bounce b2r0c0 = Bounce(button2,16);
Bounce b2r0c1 = Bounce(button2,16);
Bounce b2r0c2 = Bounce(button2,16);
Bounce b2r0c3 = Bounce(button2,16);
Bounce b2r0c4 = Bounce(button2,16);
Bounce b2r0c5 = Bounce(button2,16);
Bounce b2r0c6 = Bounce(button2,16);
Bounce b2r0c7 = Bounce(button2,16);
Bounce b2r1c0 = Bounce(button2,16);
Bounce b2r1c1 = Bounce(button2,16);
Bounce b2r1c2 = Bounce(button2,16);
Bounce b2r1c3 = Bounce(button2,16);
Bounce b2r1c4 = Bounce(button2,16);
Bounce b2r1c5 = Bounce(button2,16);
Bounce b2r1c6 = Bounce(button2,16);
Bounce b2r1c7 = Bounce(button2,16);
Bounce b2r2c0 = Bounce(button2,16);
Bounce b2r2c1 = Bounce(button2,16);
Bounce b2r2c2 = Bounce(button2,16);
Bounce b2r2c3 = Bounce(button2,16);
Bounce b2r2c4 = Bounce(button2,16);
Bounce b2r2c5 = Bounce(button2,16);
Bounce b2r2c6 = Bounce(button2,16);
Bounce b2r2c7 = Bounce(button2,16);
Bounce b2r3c0 = Bounce(button2,16);
Bounce b2r3c1 = Bounce(button2,16);
Bounce b2r3c2 = Bounce(button2,16);
Bounce b2r3c3 = Bounce(button2,16);
Bounce b2r3c4 = Bounce(button2,16);
Bounce b2r3c5 = Bounce(button2,16);
Bounce b2r3c6 = Bounce(button2,16);
Bounce b2r3c7 = Bounce(button2,16);
Bounce b2r4c0 = Bounce(button2,16);
Bounce b2r4c1 = Bounce(button2,16);
Bounce b2r4c2 = Bounce(button2,16);
Bounce b2r4c3 = Bounce(button2,16);
Bounce b2r4c4 = Bounce(button2,16);
Bounce b2r4c5 = Bounce(button2,16);
Bounce b2r4c6 = Bounce(button2,16);
Bounce b2r4c7 = Bounce(button2,16);
Bounce b2r5c0 = Bounce(button2,16);
Bounce b2r5c1 = Bounce(button2,16);
Bounce b2r5c2 = Bounce(button2,16);
Bounce b2r5c3 = Bounce(button2,16);
Bounce b2r5c4 = Bounce(button2,16);
Bounce b2r5c5 = Bounce(button2,16);
Bounce b2r5c6 = Bounce(button2,16);
Bounce b2r5c7 = Bounce(button2,16);
Bounce b2r6c0 = Bounce(button2,16);
Bounce b2r6c1 = Bounce(button2,16);
Bounce b2r6c2 = Bounce(button2,16);
Bounce b2r6c3 = Bounce(button2,16);
Bounce b2r6c4 = Bounce(button2,16);
Bounce b2r6c5 = Bounce(button2,16);
Bounce b2r6c6 = Bounce(button2,16);
Bounce b2r6c7 = Bounce(button2,16);
Bounce b2r7c0 = Bounce(button2,16);
Bounce b2r7c1 = Bounce(button2,16);
Bounce b2r7c2 = Bounce(button2,16);
Bounce b2r7c3 = Bounce(button2,16);
Bounce b2r7c4 = Bounce(button2,16);
Bounce b2r7c5 = Bounce(button2,16);
Bounce b2r7c6 = Bounce(button2,16);
Bounce b2r7c7 = Bounce(button2,16);
Bounce b3r0c0 = Bounce(button3,17);
Bounce b3r0c1 = Bounce(button3,17);
Bounce b3r0c2 = Bounce(button3,17);
Bounce b3r0c3 = Bounce(button3,17);
Bounce b3r0c4 = Bounce(button3,17);
Bounce b3r0c5 = Bounce(button3,17);
Bounce b3r0c6 = Bounce(button3,17);
Bounce b3r0c7 = Bounce(button3,17);
Bounce b3r1c0 = Bounce(button3,17);
Bounce b3r1c1 = Bounce(button3,17);
Bounce b3r1c2 = Bounce(button3,17);
Bounce b3r1c3 = Bounce(button3,17);
Bounce b3r1c4 = Bounce(button3,17);
Bounce b3r1c5 = Bounce(button3,17);
Bounce b3r1c6 = Bounce(button3,17);
Bounce b3r1c7 = Bounce(button3,17);
Bounce b3r2c0 = Bounce(button3,17);
Bounce b3r2c1 = Bounce(button3,17);
Bounce b3r2c2 = Bounce(button3,17);
Bounce b3r2c3 = Bounce(button3,17);
Bounce b3r2c4 = Bounce(button3,17);
Bounce b3r2c5 = Bounce(button3,17);
Bounce b3r2c6 = Bounce(button3,17);
Bounce b3r2c7 = Bounce(button3,17);
Bounce b3r3c0 = Bounce(button3,17);
Bounce b3r3c1 = Bounce(button3,17);
Bounce b3r3c2 = Bounce(button3,17);
Bounce b3r3c3 = Bounce(button3,17);
Bounce b3r3c4 = Bounce(button3,17);
Bounce b3r3c5 = Bounce(button3,17);
Bounce b3r3c6 = Bounce(button3,17);
Bounce b3r3c7 = Bounce(button3,17);
Bounce b3r4c0 = Bounce(button3,17);
Bounce b3r4c1 = Bounce(button3,17);
Bounce b3r4c2 = Bounce(button3,17);
Bounce b3r4c3 = Bounce(button3,17);
Bounce b3r4c4 = Bounce(button3,17);
Bounce b3r4c5 = Bounce(button3,17);
Bounce b3r4c6 = Bounce(button3,17);
Bounce b3r4c7 = Bounce(button3,17);
Bounce b3r5c0 = Bounce(button3,17);
Bounce b3r5c1 = Bounce(button3,17);
Bounce b3r5c2 = Bounce(button3,17);
Bounce b3r5c3 = Bounce(button3,17);
Bounce b3r5c4 = Bounce(button3,17);
Bounce b3r5c5 = Bounce(button3,17);
Bounce b3r5c6 = Bounce(button3,17);
Bounce b3r5c7 = Bounce(button3,17);
Bounce b3r6c0 = Bounce(button3,17);
Bounce b3r6c1 = Bounce(button3,17);
Bounce b3r6c2 = Bounce(button3,17);
Bounce b3r6c3 = Bounce(button3,17);
Bounce b3r6c4 = Bounce(button3,17);
Bounce b3r6c5 = Bounce(button3,17);
Bounce b3r6c6 = Bounce(button3,17);
Bounce b3r6c7 = Bounce(button3,17);
Bounce b3r7c0 = Bounce(button3,17);
Bounce b3r7c1 = Bounce(button3,17);
Bounce b3r7c2 = Bounce(button3,17);
Bounce b3r7c3 = Bounce(button3,17);
Bounce b3r7c4 = Bounce(button3,17);
Bounce b3r7c5 = Bounce(button3,17);
Bounce b3r7c6 = Bounce(button3,17);
Bounce b3r7c7 = Bounce(button3,17);
void setup() {
Serial.begin(115200);
pinMode(touch0,INPUT); //pin mode
pinMode(touch1,INPUT);
pinMode(transmitA,OUTPUT);
pinMode(transmitB,OUTPUT);
pinMode(transmitC,OUTPUT);
pinMode(reciverA,OUTPUT);
pinMode(reciverB,OUTPUT);
pinMode(reciverC,OUTPUT);
pinMode(led,OUTPUT);
digitalWrite (led, HIGH);
pinMode(button0,INPUT);
pinMode(button1,INPUT);
pinMode(button2,INPUT);
pinMode(button3,INPUT);
pinMode(fader0,INPUT);
pinMode(fader1,INPUT);
pwm0.begin(); //I2C setting/start
pwm1.begin();
pwm0.setPWMFreq(1600); // This is the maximum PWM frequency
pwm1.setPWMFreq(1600);
uint8_t twbrbackup = TWBR;
TWBR = 12; //freq = clock / (16 + (2 * TWBR))
}
//Encoder
long old0Enc0 = -999;
long old1Enc1 = -999;
long old2Enc2 = -999;
long old3Enc3 = -999;
void loop(){
usbMIDI.read(); //usb in
if (usbMIDI.getType() == 7 && usbMIDI.getSysExArray()[1] == 127 && usbMIDI.getSysExArray()[5]==6)
{
channelnum = usbMIDI.getSysExArray()[6];
channelloc = usbMIDI.getSysExArray()[9];
}
for(i=0;i<=63;i++) { //button/fader scan/update
{
digitalWrite (reciverA, (i & 1) ? HIGH : LOW);
digitalWrite (reciverB, (i & 2) ? HIGH : LOW);
digitalWrite (reciverC, (i & 4) ? HIGH : LOW);
digitalWrite (transmitA, (i & 8) ? HIGH : LOW);
digitalWrite (transmitB, (i & 16) ? HIGH : LOW);
digitalWrite (transmitC, (i & 32) ? HIGH : LOW);
delayMicroseconds(20);
if(i==0){
fader00 = analogRead(fader0);
fader08 = analogRead(fader1);
touch00 = touchRead(touch0);
touch08 = touchRead(touch1);
b0r0c0.update();
b1r0c0.update();
b2r0c0.update();
b3r0c0.update();
}
if(i==1){
b0r1c0.update();
b1r1c0.update();
b2r1c0.update();
b3r1c0.update();
}
if(i==2){
b0r2c0.update();
b1r2c0.update();
b2r2c0.update();
b3r2c0.update();
}
if(i==3){
b0r3c0.update();
b1r3c0.update();
b2r3c0.update();
b3r3c0.update();
}
if(i==4){
b0r4c0.update();
b1r4c0.update();
b2r4c0.update();
b3r4c0.update();
}
if(i==5){
b0r5c0.update();
b1r5c0.update();
b2r5c0.update();
b3r5c0.update();
}
if(i==6){
b0r6c0.update();
b1r6c0.update();
b2r6c0.update();
b3r6c0.update();
}
if(i==7){
b0r7c0.update();
b1r7c0.update();
b2r7c0.update();
b3r7c0.update();
}
if(i==8){
fader01 = analogRead(fader0);
fader09 = analogRead(fader1);
touch01 = touchRead(touch0);
touch09 = touchRead(touch1);
b0r0c1.update();
b1r0c1.update();
b2r0c1.update();
b3r0c1.update();
}
if(i==9){
b0r1c1.update();
b1r1c1.update();
b2r1c1.update();
b3r1c1.update();
}
if(i==10){
b0r2c1.update();
b1r2c1.update();
b2r2c1.update();
b3r2c1.update();
}
if(i==11){
b0r3c1.update();
b1r3c1.update();
b2r3c1.update();
b3r3c1.update();
}
if(i==12){
b0r4c1.update();
b1r4c1.update();
b2r4c1.update();
b3r4c1.update();
}
if(i==13){
b0r5c1.update();
b1r5c1.update();
b2r5c1.update();
b3r5c1.update();
}
if(i==14){
b0r6c1.update();
b1r6c1.update();
b2r6c1.update();
b3r6c1.update();
}
if(i==15){
b0r7c1.update();
b1r7c1.update();
b2r7c1.update();
b3r7c1.update();
}
if(i==16){
fader02 = analogRead(fader0);
fader10 = analogRead(fader1);
touch02 = touchRead(touch0);
touch10 = touchRead(touch1);
b0r0c2.update();
b1r0c2.update();
b2r0c2.update();
b3r0c2.update();
}
if(i==17){
b0r1c2.update();
b1r1c2.update();
b2r1c2.update();
b3r1c2.update();
}
if(i==18){
b0r2c2.update();
b1r2c2.update();
b2r2c2.update();
b3r2c2.update();
}
if(i==19){
b0r3c2.update();
b1r3c2.update();
b2r3c2.update();
b3r3c2.update();
}
if(i==20){
b0r4c2.update();
b1r4c2.update();
b2r4c2.update();
b3r4c2.update();
}
if(i==21){
b0r5c2.update();
b1r5c2.update();
b2r5c2.update();
b3r5c2.update();
}
if(i==22){
b0r6c2.update();
b1r6c2.update();
b2r6c2.update();
b3r6c2.update();
}
if(i==23){
b0r7c2.update();
b1r7c2.update();
b2r7c2.update();
b3r7c2.update();
}
if(i==24){
fader03 = analogRead(fader0);
fader11 = analogRead(fader1);
touch03 = touchRead(touch0);
touch11 = touchRead(touch1);
b0r0c3.update();
b1r0c3.update();
b2r0c3.update();
b3r0c3.update();
}
if(i==25){
b0r1c3.update();
b1r1c3.update();
b2r1c3.update();
b3r1c3.update();
}
if(i==26){
b0r2c3.update();
b1r2c3.update();
b2r2c3.update();
b3r2c3.update();
}
if(i==27){
b0r3c3.update();
b1r3c3.update();
b2r3c3.update();
b3r3c3.update();
}
if(i==28){
b0r4c3.update();
b1r4c3.update();
b2r4c3.update();
b3r4c3.update();
}
if(i==29){
b0r5c3.update();
b1r5c3.update();
b2r5c3.update();
b3r5c3.update();
}
if(i==30){
b0r6c3.update();
b1r6c3.update();
b2r6c3.update();
b3r6c3.update();
}
if(i==31){
b0r7c3.update();
b1r7c3.update();
b2r7c3.update();
b3r7c3.update();
}
if(i==32){
fader04 = analogRead(fader0);
fader12 = analogRead(fader1);
touch04 = touchRead(touch0);
touch12 = touchRead(touch1);
b0r0c4.update();
b1r0c4.update();
b2r0c4.update();
b3r0c4.update();
}
if(i==33){
b0r1c4.update();
b1r1c4.update();
b2r1c4.update();
b3r1c4.update();
}
if(i==34){
b0r2c4.update();
b1r2c4.update();
b2r2c4.update();
b3r2c4.update();
}
if(i==35){
b0r3c4.update();
b1r3c4.update();
b2r3c4.update();
b3r3c4.update();
}
if(i==36){
b0r4c4.update();
b1r4c4.update();
b2r4c4.update();
b3r4c4.update();
}
if(i==37){
b0r5c4.update();
b1r5c4.update();
b2r5c4.update();
b3r5c4.update();
}
if(i==38){
b0r6c4.update();
b1r6c4.update();
b2r6c4.update();
b3r6c4.update();
}
if(i==39){
b0r7c4.update();
b1r7c4.update();
b2r7c4.update();
b3r7c4.update();
}
if(i==40){
fader05 = analogRead(fader0);
fader13 = analogRead(fader1);
touch05 = touchRead(touch0);
touch13 = touchRead(touch1);
b0r0c5.update();
b1r0c5.update();
b2r0c5.update();
b3r0c5.update();
}
if(i==41){
b0r1c5.update();
b1r1c5.update();
b2r1c5.update();
b3r1c5.update();
}
if(i==42){
b0r2c5.update();
b1r2c5.update();
b2r2c5.update();
b3r2c5.update();
}
if(i==43){
b0r3c5.update();
b1r3c5.update();
b2r3c5.update();
b3r3c5.update();
}
if(i==44){
b0r4c5.update();
b1r4c5.update();
b2r4c5.update();
b3r4c5.update();
}
if(i==45){
b0r5c5.update();
b1r5c5.update();
b2r5c5.update();
b3r5c5.update();
}
if(i==46){
b0r6c5.update();
b1r6c5.update();
b2r6c5.update();
b3r6c5.update();
}
if(i==47){
b0r7c5.update();
b1r7c5.update();
b2r7c5.update();
b3r7c5.update();
}
if(i==48){
fader06 = analogRead(fader0);
fader14 = analogRead(fader1);
touch06 = touchRead(touch0);
touch14 = touchRead(touch1);
b0r0c6.update();
b1r0c6.update();
b2r0c6.update();
b3r0c6.update();
}
if(i==49){
b0r1c6.update();
b1r1c6.update();
b2r1c6.update();
b3r1c6.update();
}
if(i==50){
b0r2c6.update();
b1r2c6.update();
b2r2c6.update();
b3r2c6.update();
}
if(i==51){
b0r3c6.update();
b1r3c6.update();
b2r3c6.update();
b3r3c6.update();
}
if(i==52){
b0r4c6.update();
b1r4c6.update();
b2r4c6.update();
b3r4c6.update();
}
if(i==53){
b0r5c6.update();
b1r5c6.update();
b2r5c6.update();
b3r5c6.update();
}
if(i==54){
b0r6c6.update();
b1r6c6.update();
b2r6c6.update();
b3r6c6.update();
}
if(i==55){
b0r7c6.update();
b1r7c6.update();
b2r7c6.update();
b3r7c6.update();
}
if(i==56){
fader07 = analogRead(fader0);
touch07 = touchRead(touch0);
b0r0c7.update();
b1r0c7.update();
b2r0c7.update();
b3r0c7.update();
}
if(i==57){
b0r1c7.update();
b1r1c7.update();
b2r1c7.update();
b3r1c7.update();
}
if(i==58){
b0r2c7.update();
b1r2c7.update();
b2r2c7.update();
b3r2c7.update();
}
if(i==59){
b0r3c7.update();
b1r3c7.update();
b2r3c7.update();
b3r3c7.update();
}
if(i==60){
b0r4c7.update();
b1r4c7.update();
b2r4c7.update();
b3r4c7.update();
}
if(i==61){
b0r5c7.update();
b1r5c7.update();
b2r5c7.update();
b3r5c7.update();
}
if(i==62){
b0r6c7.update();
b1r6c7.update();
b2r6c7.update();
b3r6c7.update();
}
if(i==63){
b0r7c7.update();
b1r7c7.update();
b2r7c7.update();
b3r7c7.update();
}
}
}
if(channelnum == 0,15,30,45){ //midi in to move faders
newfader00 = channelloc;
}
if(channelnum == 1,16,31,46){
newfader01 = channelloc;
}
if(channelnum == 2,17,32,47){
newfader02 = channelloc;
}
if(channelnum == 3,18,33,48){
newfader03 = channelloc;
}
if(channelnum == 4,19,34,49){
newfader04 = channelloc;
}
if(channelnum == 5,20,35,50){
newfader05 = channelloc;
}
if(channelnum == 6,21,36,51){
newfader06 = channelloc;
}
if(channelnum == 7,22,37,52){
newfader07 = channelloc;
}
if(channelnum == 8,23,38,53){
newfader08 = channelloc;
}
if(channelnum == 9,24,39,54){
newfader09 = channelloc;
}
if(channelnum == 10,25,40,55){
newfader10 = channelloc;
}
if(channelnum == 11,26,41,56){
newfader11 = channelloc;
}
if(channelnum == 12,27,42,57){
newfader12 = channelloc;
}
if(channelnum == 13,28,43,58){
newfader13 = channelloc;
}
if(channelnum == 14,29,44,59){
newfader14 = channelloc;
}
if(touch00 < 2000){ //moving of faders
if(newfader00 < fader00 - 10 && newfader00 > faderMin) {
pwm0.setPWM(0,4096,0);
}
if(newfader00 > fader00 - 10) {
pwm0.setPWM(0,0,0);
}
if(newfader00 > fader00 + 10 && newfader00 < faderMax) {
pwm0.setPWM(1,4096,0);
}
if(newfader00 < fader00 + 10) {
pwm0.setPWM(1,0,0);
}
}
if(touch01 < 2000){
if(newfader01 < fader01 - 10 && newfader01 > faderMin) {
pwm0.setPWM(2,4096,0);
}
if(newfader01 > fader00 - 10) {
pwm0.setPWM(2,0,0);
}
if(newfader01 > fader01 + 10 && newfader01 < faderMax) {
pwm0.setPWM(3,4096,0);
}
if(newfader01 < fader00 + 10) {
pwm0.setPWM(3,0,0);
}
}
if(touch02 < 2000){
if(newfader02 < fader02 - 10 && newfader02 > faderMin) {
pwm0.setPWM(4,4096,0);
}
if(newfader02 > fader02 - 10) {
pwm0.setPWM(4,0,0);
}
if(newfader02 > fader02 + 10 && newfader02 < faderMax) {
pwm0.setPWM(5,4096,0);
}
if(newfader02 < fader02 + 10) {
pwm0.setPWM(5,0,0);
}
}
if(touch03 < 2000){
if(newfader03 < fader03 - 10 && newfader03 > faderMin) {
pwm0.setPWM(6,4096,0);
}
if(newfader03 > fader03 - 10) {
pwm0.setPWM(6,0,0);
}
if(newfader03 > fader03 + 10 && newfader03 < faderMax) {
pwm0.setPWM(7,4096,0);
}
if(newfader03 < fader03 + 10) {
pwm0.setPWM(7,0,0);
}
}
if(touch04 < 2000){
if(newfader04 < fader04 - 10 && newfader04 > faderMin) {
pwm0.setPWM(8,4096,0);
}
if(newfader04 > fader04 - 10) {
pwm0.setPWM(8,0,0);
}
if(newfader04 > fader04 + 10 && newfader04 < faderMax) {
pwm0.setPWM(9,4096,0);
}
if(newfader04 < fader04 + 10) {
pwm0.setPWM(9,0,0);
}
}
if(touch05 < 2000){
if(newfader05 < fader05 - 10 && newfader05 > faderMin) {
pwm0.setPWM(10,4096,0);
}
if(newfader05 > fader05 - 10) {
pwm0.setPWM(10,0,0);
}
if(newfader05 > fader05 + 10 && newfader05 < faderMax) {
pwm0.setPWM(11,4096,0);
}
if(newfader05 < fader05 + 10) {
pwm0.setPWM(11,0,0);
}
}
if(touch06 < 2000){
if(newfader06 < fader06 - 10 && newfader06 > faderMin) {
pwm0.setPWM(12,4096,0);
}
if(newfader06 > fader06 - 10) {
pwm0.setPWM(12,0,0);
}
if(newfader06 > fader06 + 10 && newfader06 < faderMax) {
pwm0.setPWM(13,4096,0);
}
if(newfader06 < fader06 + 10) {
pwm0.setPWM(13,0,0);
}
}
if(touch07 < 2000){
if(newfader07 < fader07 - 10 && newfader07 > faderMin) {
pwm0.setPWM(14,4096,0);
}
if(newfader07 > fader07 - 10) {
pwm0.setPWM(14,0,0);
}
if(newfader07 > fader07 + 10 && newfader07 < faderMax) {
pwm0.setPWM(15,4096,0);
}
if(newfader07 < fader07 + 10) {
pwm0.setPWM(15,0,0);
}
}
if(touch08 < 2000){
if(newfader08 < fader08 - 10 && newfader08 > faderMin) {
pwm1.setPWM(0,4096,0);
}
if(newfader08 > fader08 - 10) {
pwm1.setPWM(0,0,0);
}
if(newfader08 > fader08 + 10 && newfader08 < faderMax) {
pwm1.setPWM(1,4096,0);
}
if(newfader08 < fader08 + 10) {
pwm1.setPWM(1,0,0);
}
}
if(touch09 <2000){
if(newfader09 < fader09 - 10 && newfader09 > faderMin) {
pwm1.setPWM(2,4096,0);
}
if(newfader09 > fader09 - 10) {
pwm1.setPWM(2,0,0);
}
if(newfader09 > fader09 + 10 && newfader09 < faderMax) {
pwm1.setPWM(3,4096,0);
}
if(newfader09 < fader09 + 10) {
pwm1.setPWM(3,0,0);
}
}
if(touch10 < 2000){
if(newfader10 < fader10 - 10 && newfader10 > faderMin) {
pwm1.setPWM(4,4096,0);
}
if(newfader10 > fader10 - 10) {
pwm1.setPWM(4,0,0);
}
if(newfader10 > fader10 + 10 && newfader10 < faderMax) {
pwm1.setPWM(5,4096,0);
}
if(newfader10 < fader10 + 10) {
pwm1.setPWM(5,0,0);
}
}
if(touch11 < 2000){
if(newfader11 < fader11 - 10 && newfader11 > faderMin) {
pwm1.setPWM(6,4096,0);
}
if(newfader11 > fader11 - 10) {
pwm1.setPWM(6,0,0);
}
if(newfader11 > fader11 + 10 && newfader11 < faderMax) {
pwm1.setPWM(7,4096,0);
}
if(newfader11 < fader11 + 10) {
pwm1.setPWM(7,0,0);
}
}
if(touch12 < 2000){
if(newfader12 < fader12 - 10 && newfader12 > faderMin) {
pwm1.setPWM(8,4096,0);
}
if(newfader12 > fader12 - 10) {
pwm1.setPWM(8,0,0);
}
if(newfader12 > fader12 + 10 && newfader12 < faderMax) {
pwm1.setPWM(9,4096,0);
}
if(newfader12 < fader12 + 10) {
pwm1.setPWM(9,0,0);
}
}
if(touch13 < 2000){
if(newfader13 < fader13 - 10 && newfader13 > faderMin) {
pwm1.setPWM(10,4096,0);
}
if(newfader13 > fader13 - 10) {
pwm1.setPWM(10,0,0);
}
if(newfader13 > fader13 + 10 && newfader13 < faderMax) {
pwm1.setPWM(11,4096,0);
}
if(newfader13 < fader13 + 10) {
pwm1.setPWM(11,0,0);
}
}
if(touch14 < 2000){
if(newfader14 < fader14 - 10 && newfader14 > faderMin) {
pwm1.setPWM(12,4096,0);
}
if(newfader14 > fader14 - 10) {
pwm1.setPWM(12,0,0);
}
if(newfader14 > fader14 + 10 && newfader14 < faderMax) {
pwm1.setPWM(13,4096,0);
}
if(newfader14 < fader14 + 10) {
pwm1.setPWM(13,0,0);
}
}
if(touch00>2000){ //midi out
usbMIDI.sendNoteOn(0,(fader00*0.125),3);
}
if(touch01>2000){
usbMIDI.sendNoteOn(1,(fader01*0.125),3);
}
if(touch02>2000){
usbMIDI.sendNoteOn(2,(fader02*0.125),3);
}
if(touch03>2000){
usbMIDI.sendNoteOn(3,(fader03*0.125),3);
}
if(touch04>2000){
usbMIDI.sendNoteOn(4,(fader04*0.125),3);
}
if(touch05>2000){
usbMIDI.sendNoteOn(5,(fader05*0.125),3);
}
if(touch06>2000){
usbMIDI.sendNoteOn(6,(fader06*0.125),3);
}
if(touch07>2000){
usbMIDI.sendNoteOn(7,(fader07*0.125),3);
}
if(touch08>2000){
usbMIDI.sendNoteOn(8,(fader08*0.125),3);
}
if(touch09>2000){
usbMIDI.sendNoteOn(9,(fader09*0.125),3);
}
if(touch10>2000){
usbMIDI.sendNoteOn(10,(fader10*0.125),3);
}
if(touch11>2000){
usbMIDI.sendNoteOn(11,(fader11*0.125),3);
}
if(touch12>2000){
usbMIDI.sendNoteOn(12,(fader12*0.125),3);
}
if(touch13>2000){
usbMIDI.sendNoteOn(13,(fader13*0.125),3);
}
if(touch14>2000){
usbMIDI.sendNoteOn(14,(fader14*0.125),3);
}
if(b0r0c0.risingEdge()){
usbMIDI.sendNoteOn(0,127,1);
}
if(b0r0c1.risingEdge()){
usbMIDI.sendNoteOn(1,127,1);
}
if(b0r0c2.risingEdge()){
usbMIDI.sendNoteOn(2,127,1);
}
if(b0r0c3.risingEdge()){
usbMIDI.sendNoteOn(3,127,1);
}
if(b0r0c4.risingEdge()){
usbMIDI.sendNoteOn(4,127,1);
}
if(b0r0c5.risingEdge()){
usbMIDI.sendNoteOn(5,127,1);
}
if(b0r0c6.risingEdge()){
usbMIDI.sendNoteOn(6,127,1);
}
if(b0r0c7.risingEdge()){
usbMIDI.sendNoteOn(7,127,1);
}
if(b0r1c0.risingEdge()){
usbMIDI.sendNoteOn(8,127,1);
}
if(b0r1c1.risingEdge()){
usbMIDI.sendNoteOn(9,127,1);
}
if(b0r1c2.risingEdge()){
usbMIDI.sendNoteOn(10,127,1);
}
if(b0r1c3.risingEdge()){
usbMIDI.sendNoteOn(11,127,1);
}
if(b0r1c4.risingEdge()){
usbMIDI.sendNoteOn(12,127,1);
}
if(b0r1c5.risingEdge()){
usbMIDI.sendNoteOn(13,127,1);
}
if(b0r1c6.risingEdge()){
usbMIDI.sendNoteOn(14,127,1);
}
if(b0r1c7.risingEdge()){
usbMIDI.sendNoteOn(15,127,1);
}
if(b0r2c0.risingEdge()){
usbMIDI.sendNoteOn(16,127,1);
}
if(b0r2c1.risingEdge()){
usbMIDI.sendNoteOn(17,127,1);
}
if(b0r2c2.risingEdge()){
usbMIDI.sendNoteOn(18,127,1);
}
if(b0r2c3.risingEdge()){
usbMIDI.sendNoteOn(19,127,1);
}
if(b0r2c4.risingEdge()){
usbMIDI.sendNoteOn(20,127,1);
}
if(b0r2c5.risingEdge()){
usbMIDI.sendNoteOn(21,127,1);
}
if(b0r2c6.risingEdge()){
usbMIDI.sendNoteOn(22,127,1);
}
if(b0r2c7.risingEdge()){
usbMIDI.sendNoteOn(23,127,1);
}
if(b0r3c0.risingEdge()){
usbMIDI.sendNoteOn(24,127,1);
}
if(b0r3c1.risingEdge()){
usbMIDI.sendNoteOn(25,127,1);
}
if(b0r3c2.risingEdge()){
usbMIDI.sendNoteOn(26,127,1);
}
if(b0r3c3.risingEdge()){
usbMIDI.sendNoteOn(27,127,1);
}
if(b0r3c4.risingEdge()){
usbMIDI.sendNoteOn(28,127,1);
}
if(b0r3c5.risingEdge()){
usbMIDI.sendNoteOn(29,127,1);
}
if(b0r3c6.risingEdge()){
usbMIDI.sendNoteOn(30,127,1);
}
if(b0r3c7.risingEdge()){
usbMIDI.sendNoteOn(31,127,1);
}
if(b0r4c0.risingEdge()){
usbMIDI.sendNoteOn(32,127,1);
}
if(b0r4c1.risingEdge()){
usbMIDI.sendNoteOn(33,127,1);
}
if(b0r4c2.risingEdge()){
usbMIDI.sendNoteOn(34,127,1);
}
if(b0r4c3.risingEdge()){
usbMIDI.sendNoteOn(35,127,1);
}
if(b0r4c4.risingEdge()){
usbMIDI.sendNoteOn(36,127,1);
}
if(b0r4c5.risingEdge()){
usbMIDI.sendNoteOn(37,127,1);
}
if(b0r4c6.risingEdge()){
usbMIDI.sendNoteOn(38,127,1);
}
if(b0r4c7.risingEdge()){
usbMIDI.sendNoteOn(39,127,1);
}
if(b0r5c0.risingEdge()){
usbMIDI.sendNoteOn(40,127,1);
}
if(b0r5c1.risingEdge()){
usbMIDI.sendNoteOn(41,127,1);
}
if(b0r5c2.risingEdge()){
usbMIDI.sendNoteOn(42,127,1);
}
if(b0r5c3.risingEdge()){
usbMIDI.sendNoteOn(43,127,1);
}
if(b0r5c4.risingEdge()){
usbMIDI.sendNoteOn(44,127,1);
}
if(b0r5c5.risingEdge()){
usbMIDI.sendNoteOn(45,127,1);
}
if(b0r5c6.risingEdge()){
usbMIDI.sendNoteOn(46,127,1);
}
if(b0r5c7.risingEdge()){
usbMIDI.sendNoteOn(47,127,1);
}
if(b0r6c0.risingEdge()){
usbMIDI.sendNoteOn(48,127,1);
}
if(b0r6c1.risingEdge()){
usbMIDI.sendNoteOn(49,127,1);
}
if(b0r6c2.risingEdge()){
usbMIDI.sendNoteOn(50,127,1);
}
if(b0r6c3.risingEdge()){
usbMIDI.sendNoteOn(51,127,1);
}
if(b0r6c4.risingEdge()){
usbMIDI.sendNoteOn(52,127,1);
}
if(b0r6c5.risingEdge()){
usbMIDI.sendNoteOn(53,127,1);
}
if(b0r6c6.risingEdge()){
usbMIDI.sendNoteOn(54,127,1);
}
if(b0r6c7.risingEdge()){
usbMIDI.sendNoteOn(55,127,1);
}
if(b0r7c0.risingEdge()){
usbMIDI.sendNoteOn(56,127,1);
}
if(b0r7c1.risingEdge()){
usbMIDI.sendNoteOn(57,127,1);
}
if(b0r7c2.risingEdge()){
usbMIDI.sendNoteOn(58,127,1);
}
if(b0r7c3.risingEdge()){
usbMIDI.sendNoteOn(59,127,1);
}
if(b0r7c4.risingEdge()){
usbMIDI.sendNoteOn(60,127,1);
}
if(b0r7c5.risingEdge()){
usbMIDI.sendNoteOn(61,127,1);
}
if(b0r7c6.risingEdge()){
usbMIDI.sendNoteOn(62,127,1);
}
if(b0r7c7.risingEdge()){
usbMIDI.sendNoteOn(63,127,1);
}
if(b1r0c0.risingEdge()){
usbMIDI.sendNoteOn(64,127,1);
}
if(b1r0c1.risingEdge()){
usbMIDI.sendNoteOn(65,127,1);
}
if(b1r0c2.risingEdge()){
usbMIDI.sendNoteOn(66,127,1);
}
if(b1r0c3.risingEdge()){
usbMIDI.sendNoteOn(67,127,1);
}
if(b1r0c4.risingEdge()){
usbMIDI.sendNoteOn(68,127,1);
}
if(b1r0c5.risingEdge()){
usbMIDI.sendNoteOn(69,127,1);
}
if(b1r0c6.risingEdge()){
usbMIDI.sendNoteOn(70,127,1);
}
if(b1r0c7.risingEdge()){
usbMIDI.sendNoteOn(71,127,1);
}
if(b1r1c0.risingEdge()){
usbMIDI.sendNoteOn(72,127,1);
}
if(b1r1c1.risingEdge()){
usbMIDI.sendNoteOn(73,127,1);
}
if(b1r1c2.risingEdge()){
usbMIDI.sendNoteOn(74,127,1);
}
if(b1r1c3.risingEdge()){
usbMIDI.sendNoteOn(75,127,1);
}
if(b1r1c4.risingEdge()){
usbMIDI.sendNoteOn(76,127,1);
}
if(b1r1c5.risingEdge()){
usbMIDI.sendNoteOn(77,127,1);
}
if(b1r1c6.risingEdge()){
usbMIDI.sendNoteOn(78,127,1);
}
if(b1r1c7.risingEdge()){
usbMIDI.sendNoteOn(79,127,1);
}
if(b1r2c0.risingEdge()){
usbMIDI.sendNoteOn(80,127,1);
}
if(b1r2c1.risingEdge()){
usbMIDI.sendNoteOn(81,127,1);
}
if(b1r2c2.risingEdge()){
usbMIDI.sendNoteOn(82,127,1);
}
if(b1r2c3.risingEdge()){
usbMIDI.sendNoteOn(83,127,1);
}
if(b1r2c4.risingEdge()){
usbMIDI.sendNoteOn(84,127,1);
}
if(b1r2c5.risingEdge()){
usbMIDI.sendNoteOn(85,127,1);
}
if(b1r2c6.risingEdge()){
usbMIDI.sendNoteOn(86,127,1);
}
if(b1r2c7.risingEdge()){
usbMIDI.sendNoteOn(87,127,1);
}
if(b1r3c0.risingEdge()){
usbMIDI.sendNoteOn(88,127,1);
}
if(b1r3c1.risingEdge()){
usbMIDI.sendNoteOn(89,127,1);
}
if(b1r3c2.risingEdge()){
usbMIDI.sendNoteOn(90,127,1);
}
if(b1r3c3.risingEdge()){
usbMIDI.sendNoteOn(91,127,1);
}
if(b1r3c4.risingEdge()){
usbMIDI.sendNoteOn(92,127,1);
}
if(b1r3c5.risingEdge()){
usbMIDI.sendNoteOn(93,127,1);
}
if(b1r3c6.risingEdge()){
usbMIDI.sendNoteOn(94,127,1);
}
if(b1r3c7.risingEdge()){
usbMIDI.sendNoteOn(95,127,1);
}
if(b1r4c0.risingEdge()){
usbMIDI.sendNoteOn(96,127,1);
}
if(b1r4c1.risingEdge()){
usbMIDI.sendNoteOn(97,127,1);
}
if(b1r4c2.risingEdge()){
usbMIDI.sendNoteOn(98,127,1);
}
if(b1r4c3.risingEdge()){
usbMIDI.sendNoteOn(99,127,1);
}
if(b1r4c4.risingEdge()){
usbMIDI.sendNoteOn(100,127,1);
}
if(b1r4c5.risingEdge()){
usbMIDI.sendNoteOn(101,127,1);
}
if(b1r4c6.risingEdge()){
usbMIDI.sendNoteOn(102,127,1);
}
if(b1r4c7.risingEdge()){
usbMIDI.sendNoteOn(103,127,1);
}
if(b1r5c0.risingEdge()){
usbMIDI.sendNoteOn(104,127,1);
}
if(b1r5c1.risingEdge()){
usbMIDI.sendNoteOn(105,127,1);
}
if(b1r5c2.risingEdge()){
usbMIDI.sendNoteOn(106,127,1);
}
if(b1r5c3.risingEdge()){
usbMIDI.sendNoteOn(107,127,1);
}
if(b1r5c4.risingEdge()){
usbMIDI.sendNoteOn(108,127,1);
}
if(b1r5c5.risingEdge()){
usbMIDI.sendNoteOn(109,127,1);
}
if(b1r5c6.risingEdge()){
usbMIDI.sendNoteOn(110,127,1);
}
if(b1r5c7.risingEdge()){
usbMIDI.sendNoteOn(111,127,2);
}
if(b1r6c0.risingEdge()){
usbMIDI.sendNoteOn(112,127,1);
}
if(b1r6c1.risingEdge()){
usbMIDI.sendNoteOn(112,127,1);
}
if(b1r6c2.risingEdge()){
usbMIDI.sendNoteOn(113,127,1);
}
if(b1r6c3.risingEdge()){
usbMIDI.sendNoteOn(114,127,1);
}
if(b1r6c4.risingEdge()){
usbMIDI.sendNoteOn(115,127,1);
}
if(b1r6c5.risingEdge()){
usbMIDI.sendNoteOn(116,127,1);
}
if(b1r6c6.risingEdge()){
usbMIDI.sendNoteOn(117,127,1);
}
if(b1r6c7.risingEdge()){
usbMIDI.sendNoteOn(118,127,1);
}
if(b1r7c0.risingEdge()){
usbMIDI.sendNoteOn(119,127,1);
}
if(b1r7c1.risingEdge()){
usbMIDI.sendNoteOn(120,127,1);
}
if(b1r7c2.risingEdge()){
usbMIDI.sendNoteOn(121,127,1);
}
if(b1r7c3.risingEdge()){
usbMIDI.sendNoteOn(122,127,1);
}
if(b1r7c4.risingEdge()){
usbMIDI.sendNoteOn(123,127,1);
}
if(b1r7c5.risingEdge()){
usbMIDI.sendNoteOn(124,127,1);
}
if(b1r7c6.risingEdge()){
usbMIDI.sendNoteOn(125,127,1);
}
if(b1r7c7.risingEdge()){
usbMIDI.sendNoteOn(126,127,1);
}
if(b2r0c0.risingEdge()){
usbMIDI.sendNoteOn(0,127,1);
}
if(b2r0c1.risingEdge()){
usbMIDI.sendNoteOn(1,127,2);
}
if(b2r0c2.risingEdge()){
usbMIDI.sendNoteOn(2,127,2);
}
if(b2r0c3.risingEdge()){
usbMIDI.sendNoteOn(3,127,2);
}
if(b2r0c4.risingEdge()){
usbMIDI.sendNoteOn(4,127,2);
}
if(b2r0c5.risingEdge()){
usbMIDI.sendNoteOn(5,127,2);
}
if(b2r0c6.risingEdge()){
usbMIDI.sendNoteOn(6,127,2);
}
if(b2r0c7.risingEdge()){
usbMIDI.sendNoteOn(7,127,2);
}
if(b2r1c0.risingEdge()){
usbMIDI.sendNoteOn(8,127,2);
}
if(b2r1c1.risingEdge()){
usbMIDI.sendNoteOn(9,127,2);
}
if(b2r1c2.risingEdge()){
usbMIDI.sendNoteOn(10,127,2);
}
if(b2r1c3.risingEdge()){
usbMIDI.sendNoteOn(11,127,2);
}
if(b2r1c4.risingEdge()){
usbMIDI.sendNoteOn(12,127,2);
}
if(b2r1c5.risingEdge()){
usbMIDI.sendNoteOn(13,127,2);
}
if(b2r1c6.risingEdge()){
usbMIDI.sendNoteOn(14,127,2);
}
if(b2r1c7.risingEdge()){
usbMIDI.sendNoteOn(15,127,2);
}
if(b2r2c0.risingEdge()){
usbMIDI.sendNoteOn(16,127,2);
}
if(b2r2c1.risingEdge()){
usbMIDI.sendNoteOn(17,127,2);
}
if(b2r2c2.risingEdge()){
usbMIDI.sendNoteOn(18,127,2);
}
if(b2r2c3.risingEdge()){
usbMIDI.sendNoteOn(19,127,2);
}
if(b2r2c4.risingEdge()){
usbMIDI.sendNoteOn(20,127,2);
}
if(b2r2c5.risingEdge()){
usbMIDI.sendNoteOn(21,127,2);
}
if(b2r2c6.risingEdge()){
usbMIDI.sendNoteOn(22,127,2);
}
if(b2r2c7.risingEdge()){
usbMIDI.sendNoteOn(23,127,2);
}
if(b2r3c0.risingEdge()){
usbMIDI.sendNoteOn(24,127,2);
}
if(b2r3c1.risingEdge()){
usbMIDI.sendNoteOn(25,127,2);
}
if(b2r3c2.risingEdge()){
usbMIDI.sendNoteOn(26,127,2);
}
if(b2r3c3.risingEdge()){
usbMIDI.sendNoteOn(27,127,2);
}
if(b2r3c4.risingEdge()){
usbMIDI.sendNoteOn(28,127,2);
}
if(b2r3c5.risingEdge()){
usbMIDI.sendNoteOn(29,127,2);
}
if(b2r3c6.risingEdge()){
usbMIDI.sendNoteOn(30,127,2);
}
if(b2r3c7.risingEdge()){
usbMIDI.sendNoteOn(31,127,2);
}
if(b2r4c0.risingEdge()){
usbMIDI.sendNoteOn(32,127,2);
}
if(b2r4c1.risingEdge()){
usbMIDI.sendNoteOn(33,127,2);
}
if(b2r4c2.risingEdge()){
usbMIDI.sendNoteOn(34,127,2);
}
if(b2r4c3.risingEdge()){
usbMIDI.sendNoteOn(35,127,2);
}
if(b2r4c4.risingEdge()){
usbMIDI.sendNoteOn(36,127,2);
}
if(b2r4c5.risingEdge()){
usbMIDI.sendNoteOn(37,127,2);
}
if(b2r4c6.risingEdge()){
usbMIDI.sendNoteOn(38,127,2);
}
if(b2r4c7.risingEdge()){
usbMIDI.sendNoteOn(39,127,2);
}
if(b2r5c0.risingEdge()){
usbMIDI.sendNoteOn(40,127,2);
}
if(b2r5c1.risingEdge()){
usbMIDI.sendNoteOn(41,127,2);
}
if(b2r5c2.risingEdge()){
usbMIDI.sendNoteOn(42,127,2);
}
if(b2r5c3.risingEdge()){
usbMIDI.sendNoteOn(43,127,2);
}
if(b2r5c4.risingEdge()){
usbMIDI.sendNoteOn(44,127,2);
}
if(b2r5c5.risingEdge()){
usbMIDI.sendNoteOn(45,127,2);
}
if(b2r5c6.risingEdge()){
usbMIDI.sendNoteOn(46,127,2);
}
if(b2r5c7.risingEdge()){
usbMIDI.sendNoteOn(47,127,2);
}
if(b2r6c0.risingEdge()){
usbMIDI.sendNoteOn(48,127,2);
}
if(b2r6c1.risingEdge()){
usbMIDI.sendNoteOn(49,127,2);
}
if(b2r6c2.risingEdge()){
usbMIDI.sendNoteOn(50,127,2);
}
if(b2r6c3.risingEdge()){
usbMIDI.sendNoteOn(51,127,2);
}
if(b2r6c4.risingEdge()){
usbMIDI.sendNoteOn(52,127,2);
}
if(b2r6c5.risingEdge()){
usbMIDI.sendNoteOn(53,127,2);
}
if(b2r6c6.risingEdge()){
usbMIDI.sendNoteOn(54,127,2);
}
if(b2r6c7.risingEdge()){
usbMIDI.sendNoteOn(55,127,2);
}
if(b2r7c0.risingEdge()){
usbMIDI.sendNoteOn(56,127,2);
}
if(b2r7c1.risingEdge()){
usbMIDI.sendNoteOn(57,127,2);
}
if(b2r7c2.risingEdge()){
usbMIDI.sendNoteOn(58,127,2);
}
if(b2r7c3.risingEdge()){
usbMIDI.sendNoteOn(59,127,2);
}
if(b2r7c4.risingEdge()){
usbMIDI.sendNoteOn(60,127,2);
}
if(b2r7c5.risingEdge()){
usbMIDI.sendNoteOn(61,127,2);
}
if(b2r7c6.risingEdge()){
usbMIDI.sendNoteOn(62,127,2);
}
if(b2r7c7.risingEdge()){
usbMIDI.sendNoteOn(63,127,2);
}
if(b3r0c0.risingEdge()){
usbMIDI.sendNoteOn(64,127,2);
}
if(b3r0c1.risingEdge()){
usbMIDI.sendNoteOn(65,127,2);
}
if(b3r0c2.risingEdge()){
usbMIDI.sendNoteOn(66,127,2);
}
if(b3r0c3.risingEdge()){
usbMIDI.sendNoteOn(67,127,2);
}
if(b3r0c4.risingEdge()){
usbMIDI.sendNoteOn(68,127,2);
}
if(b3r0c5.risingEdge()){
usbMIDI.sendNoteOn(69,127,2);
}
if(b3r0c6.risingEdge()){
usbMIDI.sendNoteOn(70,127,2);
}
if(b3r0c7.risingEdge()){
usbMIDI.sendNoteOn(71,127,2);
}
if(b3r1c0.risingEdge()){
usbMIDI.sendNoteOn(72,127,2);
}
if(b3r1c1.risingEdge()){
usbMIDI.sendNoteOn(73,127,2);
}
if(b3r1c2.risingEdge()){
usbMIDI.sendNoteOn(74,127,2);
}
if(b3r1c3.risingEdge()){
usbMIDI.sendNoteOn(75,127,2);
}
if(b3r1c4.risingEdge()){
usbMIDI.sendNoteOn(76,127,2);
}
if(b3r1c5.risingEdge()){
usbMIDI.sendNoteOn(77,127,2);
}
if(b3r1c6.risingEdge()){
usbMIDI.sendNoteOn(78,127,2);
}
if(b3r1c7.risingEdge()){
usbMIDI.sendNoteOn(79,127,2);
}
if(b3r2c0.risingEdge()){
usbMIDI.sendNoteOn(80,127,2);
}
if(b3r2c1.risingEdge()){
usbMIDI.sendNoteOn(81,127,2);
}
if(b3r2c2.risingEdge()){
usbMIDI.sendNoteOn(82,127,2);
}
if(b3r2c3.risingEdge()){
usbMIDI.sendNoteOn(83,127,2);
}
if(b3r2c4.risingEdge()){
usbMIDI.sendNoteOn(84,127,2);
}
if(b3r2c5.risingEdge()){
usbMIDI.sendNoteOn(85,127,2);
}
if(b3r2c6.risingEdge()){
usbMIDI.sendNoteOn(86,127,2);
}
if(b3r2c7.risingEdge()){
usbMIDI.sendNoteOn(87,127,2);
}
if(b3r3c0.risingEdge()){
usbMIDI.sendNoteOn(88,127,2);
}
if(b3r3c1.risingEdge()){
usbMIDI.sendNoteOn(89,127,2);
}
if(b3r3c2.risingEdge()){
usbMIDI.sendNoteOn(90,127,2);
}
if(b3r3c3.risingEdge()){
usbMIDI.sendNoteOn(91,127,2);
}
if(b3r3c4.risingEdge()){
usbMIDI.sendNoteOn(92,127,2);
}
if(b3r3c5.risingEdge()){
usbMIDI.sendNoteOn(93,127,2);
}
if(b3r3c6.risingEdge()){
usbMIDI.sendNoteOn(94,127,2);
}
if(b3r3c7.risingEdge()){
usbMIDI.sendNoteOn(95,127,2);
}
if(b3r4c0.risingEdge()){
usbMIDI.sendNoteOn(96,127,2);
}
if(b3r4c1.risingEdge()){
usbMIDI.sendNoteOn(97,127,2);
}
if(b3r4c2.risingEdge()){
usbMIDI.sendNoteOn(98,127,2);
}
if(b3r4c3.risingEdge()){
usbMIDI.sendNoteOn(99,127,2);
}
if(b3r4c4.risingEdge()){
usbMIDI.sendNoteOn(100,127,2);
}
if(b3r4c5.risingEdge()){
usbMIDI.sendNoteOn(101,127,2);
}
if(b3r4c6.risingEdge()){
usbMIDI.sendNoteOn(102,127,2);
}
if(b3r4c7.risingEdge()){
usbMIDI.sendNoteOn(103,127,2);
}
if(b3r5c0.risingEdge()){
usbMIDI.sendNoteOn(104,127,2);
}
if(b3r5c1.risingEdge()){
usbMIDI.sendNoteOn(105,127,2);
}
if(b3r5c2.risingEdge()){
usbMIDI.sendNoteOn(106,127,2);
}
if(b3r5c3.risingEdge()){
usbMIDI.sendNoteOn(107,127,2);
}
if(b3r5c4.risingEdge()){
usbMIDI.sendNoteOn(108,127,2);
}
if(b3r5c5.risingEdge()){
usbMIDI.sendNoteOn(109,127,2);
}
if(b3r5c6.risingEdge()){
usbMIDI.sendNoteOn(110,127,2);
}
if(b3r5c7.risingEdge()){
usbMIDI.sendNoteOn(111,127,2);
}
if(b3r6c0.risingEdge()){
usbMIDI.sendNoteOn(112,127,2);
}
if(b3r6c1.risingEdge()){
usbMIDI.sendNoteOn(113,127,2);
}
if(b3r6c2.risingEdge()){
usbMIDI.sendNoteOn(114,127,2);
}
if(b3r6c3.risingEdge()){
usbMIDI.sendNoteOn(115,127,2);
}
if(b3r6c4.risingEdge()){
usbMIDI.sendNoteOn(116,127,2);
}
if(b3r6c5.risingEdge()){
usbMIDI.sendNoteOn(117,127,2);
}
if(b3r6c6.risingEdge()){
usbMIDI.sendNoteOn(118,127,2);
}
if(b3r6c7.risingEdge()){
usbMIDI.sendNoteOn(119,127,2);
}
if(b3r7c0.risingEdge()){
usbMIDI.sendNoteOn(120,127,2);
}
if(b3r7c1.risingEdge()){
usbMIDI.sendNoteOn(121,127,2);
}
if(b3r7c2.risingEdge()){
usbMIDI.sendNoteOn(122,127,2);
}
if(b3r7c3.risingEdge()){
usbMIDI.sendNoteOn(123,127,2);
}
if(b3r7c4.risingEdge()){
usbMIDI.sendNoteOn(124,127,2);
}
if(b3r7c5.risingEdge()){
usbMIDI.sendNoteOn(125,127,2);
}
if(b3r7c6.risingEdge()){
usbMIDI.sendNoteOn(126,127,2);
}
if(b3r7c7.risingEdge()){
usbMIDI.sendNoteOn(127,127,2);
}
}