piezo to midi code help wanted !

now it works:

int ledPin = 13   ;    // Led connected to digital pin 13 
int piezo1 = 0   ;     // Piezo 1 connected to analog 0 
byte val = 0     ;     // variable to store the value read from the sensor pin 
int statePin = 0; // variable used to store the last LED status , to toglle the light 
byte THRESHOLD = 100;  // threshold value to decide when the detected sound is a knock or not 
 
void setup()  
{ 
 pinMode(ledPin, OUTPUT); // declare the ledPin  as OUTPUT 
 Serial.begin(31250);  // set MIDI baud rate  
}  
 
void loop(){ 
 // deal with first piezo 
  val = analogRead(piezo1)/4;  
  if (val >= THRESHOLD) {  
   noteOn (144 , 10, 100); 
    digitalWrite(ledPin, HIGH); 
    delay(100); 
  }  
}


// plays a MIDInote doesn't check to see that cmd is greater  than 127 or that data values are less than 127 
void noteOn(char cmd, char data1,char data2) { 
  Serial.print(cmd, BYTE); 
  Serial.print(data1, BYTE); 
   Serial.print(data2, BYTE); 
}

just a typo: you wrote 'data 2' instead of the variable name data2. and added a few semicolons at the bginning.

//kuk

EDIT: i probably changed more than needed to be done. don't mind this, took me some time to see the problem