MIDI POTMETER

Hello,

I am currently busy making a midi pot-meter controller for our light system.

I have wrote a code in combination with the hairless midi software.

Here is my code :

int val = 0;
int outputValue =0;
int lastVal = 0;

void setup()
{
  Serial.begin(9600);
}

void loop()
{
  val = analogRead(A0);
  outputValue = map(val, 0, 1023, 0, 127);

  if (outputValue != lastVal){
    MIDImessage(176,1,outputValue);
  }        
  lastVal = outputValue;
  delay(100);
}

void MIDImessage(byte command,byte data1,byte data2)
{
  Serial.println(command);
  Serial.println(data1);
  Serial.println(data2);
}

When i start the serial date connection and test the pot-meter. I only get the next error message: +66.64 - Error: got unexpected data byte 0x0.

I have set the baud rate of the midi software tot the same as the arduino. I think i do something wrong in the byte transmission.

Moderator note - changed quote tags to code tags. OP please use code tags when posting code in future

Try Serial.write() instead of Serial.println(). You really don't need Newline charcters in your MIDI messages. And I'd use a much faster rate than 9600. The Hairless default of 115200 is good.

Steve