# Problema con Drum Arduino midi

**URL:** <https://forum.arduino.cc/t/problema-con-drum-arduino-midi/687208>\
**Category:** Software\
**Created:** [December 16, 2020, 3:48am UTC](https://forum.arduino.cc/t/problema-con-drum-arduino-midi/687208 "2020-12-16T03:48:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kenjiroxx2](https://avatars.discourse-cdn.com/v4/letter/k/dec6dc/32.png) [@Kenjiroxx2](https://forum.arduino.cc/u/Kenjiroxx2)\
**Post date:** [December 16, 2020, 3:48am UTC](https://forum.arduino.cc/t/problema-con-drum-arduino-midi/687208/1 "2020-12-16T03:48:51Z")

</div>

Buenas, necesito su ayuda, hace unos par de días compre una Batería electrónica de Rockband, esta tiene 4 Pads y 2 salidas jack 3.5 para dos pedales. Lo que quiero hacer con esto es: Utilizando Arduino conectar los pads(que son piezoeléctricos) a los puertos análogos, siguiendo tutoriales, leyendo documentos de librerías etc.. Mi problema es que me topo que cuando conecto, y declaro, los piezoeléctricos(pads) parece que Arduino manda todas las señales midi al mismo tiempo, en vez de sonar solo la que corresponde a la que toco. No entiendo que hago mal, eh probado varios códigos, eh ideado los míos propios(Basado en otros códigos igual). El Arduino además de tener los análogos ocupados por los piezoeléctricos con sus respectivas resistencias(10M ohms o 1M ohms), le conecte una salida MIDI(V5 + 220 ohms, GND, TX) y en uno de los jack como un pin Digital(PIN 2), que uso para el pedal del HIT HAT. AYUDA POR FAVOR, no se porque no me resulta.  
Les dejo el código igual, este ultimo lo cree yo basado en un ejemplo de la librería HelloDrum.

#include \<hellodrum.h\>  
#include \<MIDI.h\>  
MIDI\_CREATE\_DEFAULT\_INSTANCE();

//Please name your piezo.  
//The piezo named snare is connected to the A0 pin  
HelloDrum bombo(0);  
HelloDrum hithat(1);  
HelloDrum snare(2);  
HelloDrum loTomb(3);  
HelloDrum floorTomb(4);  
HelloDrum Crash(5);  
//Pedals  
int pedalhh = 2;

//Setting  
byte BOMBO[6] = {  
30,  
10,  
20,  
20,  
36,  
1  
};  
byte HITHAT[6]={  
30,  
10,  
20,  
20,  
46,  
1  
};  
byte HITHATCLOSE[6]={  
30,  
10,  
20,  
20,  
42,  
1  
};  
byte SNARE[6] = {  
30, //sensitivity  
10, //threshold  
20, //scantime  
20, //masktime  
38, //note  
1 //curve type  
};  
byte LOWTOMB[6]={  
30,  
10,  
20,  
20,  
45,  
1  
};  
byte FLOORTOMB[6]={  
30,  
10,  
20,  
20,  
43,  
1  
};  
byte CRASH[6]={  
30,  
10,  
20,  
20,  
49,  
1  
};

void setup()  
{  
MIDI.begin(10);  
bombo.setCurve(BOMBO[5]);  
hithat.setCurve(HITHAT[5]);  
snare.setCurve(SNARE[5]); //Set velocity curve  
loTomb.setCurve(LOWTOMB[5]);  
floorTomb.setCurve(FLOORTOMB[5]);  
Crash.setCurve(CRASH[5]);  
pinMode(pedalhh,INPUT);  
}

void loop()  
{  
//Sensing  
bombo.singlePiezo(BOMBO[0],BOMBO[1],BOMBO[2],BOMBO[3]);  
hithat.singlePiezo(HITHAT[0],HITHAT[1],HITHAT[2],HITHAT[3]);  
snare.singlePiezo(SNARE[0], SNARE[1], SNARE[2], SNARE[3]); //(sensitivity, threshold, scantime, masktime)  
loTomb.singlePiezo(LOWTOMB[0],LOWTOMB[1],LOWTOMB[2],LOWTOMB[3]);  
floorTomb.singlePiezo(FLOORTOMB[0],FLOORTOMB[1],FLOORTOMB[2],FLOORTOMB[3]);  
Crash.singlePiezo(CRASH[0],CRASH[1],CRASH[2],CRASH[3]);

//Sending MIDI signals  
if (bombo.hit == true) {  
MIDI.sendNoteOn(BOMBO[4], bombo.velocity, 10); //(note, velocity, channel)  
MIDI.sendNoteOff(BOMBO[4], 0, 10);  
}  
if (hithat.hit == true) {  
if(pedalhh==HIGH){  
MIDI.sendNoteOn(HITHATCLOSE[4], hithat.velocity, 10); //(note, velocity, channel)  
MIDI.sendNoteOff(HITHATCLOSE[4], 0, 10);  
}else{  
MIDI.sendNoteOn(HITHAT[4], hithat.velocity, 10); //(note, velocity, channel)  
MIDI.sendNoteOff(HITHAT[4], 0, 10);  
}  
}  
if (snare.hit == true) {  
MIDI.sendNoteOn(SNARE[4], snare.velocity, 10); //(note, velocity, channel)  
MIDI.sendNoteOff(SNARE[4], 0, 10);  
}  
if (loTomb.hit == true) {  
MIDI.sendNoteOn(LOWTOMB[4], loTomb.velocity, 10); //(note, velocity, channel)  
MIDI.sendNoteOff(LOWTOMB[4], 0, 10);  
}  
if (floorTomb.hit == true) {  
MIDI.sendNoteOn(FLOORTOMB[4], floorTomb.velocity, 10); //(note, velocity, channel)  
MIDI.sendNoteOff(FLOORTOMB[4], 0, 10);  
}  
if (Crash.hit == true) {  
MIDI.sendNoteOn(CRASH[4], Crash.velocity, 10); //(note, velocity, channel)  
MIDI.sendNoteOff(CRASH[4], 0, 10);  
}  
}

---

<div class="post-metadata">

**Author:** ![Surbyte](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/surbyte/32/217404_2.png) [@Surbyte](https://forum.arduino.cc/u/Surbyte)\
**Post date:** [December 28, 2020, 10:35pm UTC](https://forum.arduino.cc/t/problema-con-drum-arduino-midi/687208/2 "2020-12-28T22:35:26Z")

</div>

**Moderador**  
Hola, bienvenido al foro Arduino en Español

Por favor edita tu post usando etiquetas de código.  
[Normas del foro](http://forum.arduino.cc/index.php?topic=310951.0)

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [May 7, 2021, 12:41am UTC](https://forum.arduino.cc/t/problema-con-drum-arduino-midi/687208/3 "2021-05-07T00:41:59Z")

</div>

Closed on May 7, 2021, 12:41am UTC


