hi there!! Maybe someone can help me to improve the follow code adding 12 midi sending button
this is the code:
//#include <MIDI.h>
#include <MIDI.h>
#define numPots 6 // numer of pots
#define b 1 // this is the delta needed in
unsigned int currentPot[6] = {0,0,0,0,0,0};
unsigned int pot[6] = {0,0,0,0,0,0};
byte controlChange = 0xBC; //0xB0 or 176
void setup() {
MIDI.begin(4);
// 115200 hairless MIDI
Serial.begin(115200);
}
void loop() {
for(unsigned char i=0; i<numPots; i++) {
currentPot[i] = analogRead(i) / 8;
if(abs(currentPot[i]-pot[i]) > b) {
sendMidi(controlChange, i+1, currentPot[i]);
pot[i] = currentPot[i];
}
}
}
void sendMidi(byte controlChange, unsigned int controlNum, int val) {
//MIDI.sendControlChange(controlNum, val);
Serial.write(controlChange);
Serial.write(controlNum);
Serial.write(val);
// Serial.write(unsigned char(controlChange));
// Serial.write(unsigned char(controlNum));
// Serial.write(unsigned char(val));
}
I don't know anything about arduino code so if someone can help me... I can learn something new
Thanks
Luca