Piezo controlled MIDI drums

Hi, I'm new to Arduino and have been trying for ages to figure out a problem I have.

I currently have a piezo sensor connected to my uno and have it working so that the sensor triggers a drum sound in Ableton when hit, everything is working fine.
I would like to connect another sensor up to trigger a different drum sound but have no idea how to go about coding this!

Here is the code I have so far:

int noteOn = 144;
int piezo = A0;
int threshold = 20

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

void loop(){
  int piezoVal = analogRead(piezo);
  if (piezoVal>threshold){
    MIDImessage(noteOn, 60, 127);
    delay(100);
    MIDImessage(noteOn, 60, 0);
  }
}

//send MIDI message
void MIDImessage(byte command, byte data1, byte data2) {
  Serial.write(command);
  Serial.write(data1);
  Serial.write(data2);
}

Any help would be appreciated as I've hit a wall here!

Thanks

im a noob at this but from what i've read, it's better to use "noteOff" to end the note then "noteOn" with a 0 value. and i don't think the way you globally defined noteOn is right

Hi jtabiner, assuming that you have your MIDI controller learning, you just need to add another analog read and add the same if-else statement that you did with your previous piezo:

int piezoVal1 = analogRead(piezo1);
  if (piezoVal1>threshold){
    MIDImessage(noteOn, 60, x);
    delay(100);
    MIDImessage(noteOn, 60, 0);
  }

Refer to the link below for some advanced applications:
http://forum.arduino.cc/index.php?topic=137747.0

jtabiner:
Hi, I'm new to Arduino and have been trying for ages to figure out a problem I have.

I currently have a piezo sensor connected to my uno and have it working so that the sensor triggers a drum sound in Ableton when hit, everything is working fine.
I would like to connect another sensor up to trigger a different drum sound but have no idea how to go about coding this!

Here is the code I have so far:

int noteOn = 144;

int piezo = A0;
int threshold = 20

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

void loop(){
  int piezoVal = analogRead(piezo);
  if (piezoVal>threshold){
    MIDImessage(noteOn, 60, 127);
    delay(100);
    MIDImessage(noteOn, 60, 0);
  }
}

//send MIDI message
void MIDImessage(byte command, byte data1, byte data2) {
  Serial.write(command);
  Serial.write(data1);
  Serial.write(data2);
}




Any help would be appreciated as I've hit a wall here!

Thanks

To run many things at the same time, none of them can make the rest wait which is what delay() does.

I'll wait to see if you're still interested in answers.