sorry for the late responce i found out from trial and error that the midi message needed to be send using 4 parts
and ended up using Serial.write()\s insted of
msg.command = command; //noteon
msg.channel = channel;
msg.data2 = data2; //note
msg.data3 = data3; /* Velocity */
Serial.write((uint8_t *)&msg, sizeof(msg));
in the end this is what worked
/* The format of the message to send via serial */
typedef struct {
uint8_t command;
uint8_t channel;
uint8_t data2;
uint8_t data3;
}
t_midiMsg;
int potPin[] = {
0}; //choose the input pin for a potentometer
int potVal[] = {
0}; //variable for reading potentiometer value
int mappedPotVal[] = {
0}; //variable for holding remapped pot value
int prevPotVal[] = {
0}; //variable for storing our prev pot value
int THRESHOLD = 2;
int MAX_POT = sizeof(potPin)/2;
int channel = 1;
void setup() {
// set up serial port
Serial.begin(115200);
}
void loop() {
for (int mypots = 0; mypots < MAX_POT; mypots++){
potVal[mypots] = analogRead(potPin[mypots]); //read input from potentiometer
mappedPotVal[mypots] = map(potVal[mypots], 0, 1023, 0, 127); //map value to 0-127
if(abs(mappedPotVal[mypots] - prevPotVal[mypots]) >= THRESHOLD){
//controlChange(channel, 0xB0, mappedPotVal[mypots]);
controlChange(0xB0,1,0x01,mappedPotVal[mypots]);
//Serial.println("---------------------");
//Serial.println(mypots);
//Serial.println(mappedPotVal[mypots]);
//Serial.println("---------------------");
//delay(100);
prevPotVal[mypots] = mappedPotVal[mypots];
}
// end pot code
}
}
void controlChange(byte statusbit,byte channel, byte control, byte value)
{
Serial.write(statusbit);
Serial.write(control);
Serial.write(channel);
Serial.write(value);
}
thanks