Arduino Minimal Drum Kit

22,753

83

1

Published

Introduction: Arduino Minimal Drum Kit

About: Student, Maker, Designer

Hi.

This is minimal drum kit using arduino UNO.

First of all, please check this instructables page.

E-drum With Small 3D Printer and Thick Paper

Since I started making this, I was captivated by piezo and electronic drums.

I was fascinated by a very simple mechanism of electronic drums and the great invention called MIDI.

In other words, I could not be satisfied just by making pads.

This drum kit is roughly divided into two productions.

1.Pad made with a 3d printer and thick paper.

2.Trigger midi converter with arduino UNO .

The signal sent from the pad of " 1 " is processed by arduino of " 2 " and converted into MIDI signal. And the MIDI signal is transmitted from arduino to iPhone, laptop, etc, and sound comes out.

Let's make it!

I apologize in advance that English is not my first language


Step 1: What You'll Need

Tools

・3D Printer

・Laser Cutter (Extra)

・hex wrench

・cutter knife

・circle cutter

・Soldering Iron

Pipe Cutter

・driver drill

・drill bit 9mm / 10mm


Material

・1mm thick paper

・PLA filament

・Sponge Foam Sheets 5mm / 10mm

・MDF 2.5mm / 5.5mm (Extra)

・M6 - 70mm bolt and nuts

・M6 - 50mm bolt and nuts

・M3 - 10mm bolt and nuts

・M3 - 15mm bolt and nuts

・M3 - 25mm bolt and nuts

・M2 screw

・6.3 mm Stereo Cable

・6.3 mm TRS sockets (like this)

・13 mm diameter Stainless steel pipe


Circuit

・Piezo

FSR

・Cable

・Solder

・Universal board

・1 MΩ resistor

・10 kΩ resistor

・5.1V zener diode

Tact switch

16 x 2 LCD (I do not use this same thing, but this will be fine.)


Drum Hardware

Mesh head 10 inch / 8 inch

・Snare stand (Anything is OK. I am using YAMAHA SS662.)

・Hi-hat stand (Anything is OK. I am using YAMAHA HS650A)

・Kick pedal (Anything is OK. I am using YAMAHA FP7210A)

・Drum stick

etc..

・much time

・USB cable

Lightning to USB Camera Adapter

Step 2: 3D Printing

All data is on Thingiverse and GitHub.

Please use Ver.2 for the rim.

I printed parts with infill at 20%. The thickness of the layer is 0.3 mm.

If you can use a laser cutter, check step 3.

Step 3: Laser Cutting (Extra)

Of course, few people own laser cutters individually.

If you can freely use laser cutters from universities and companies, use this vector data.

Vector Data : https://github.com/RyoKosaka/drums/tree/master/vector

Please use MDF of 5.5 mm. It is designed to have the same dimensions as those made with a 3D printer.

So it is also possible to attach mount parts or to make it a kick pad.

There is also a way to use a laser cutter in FabLab or TechShop.

Step 4: Assembling Parts

Use M3-10mm bolts and nuts to connect the parts together.

Use the M3-15 mm or M3-25 mm bolts for the center part to fix the bottom part to each other.

Step 5: Making Shell

Since the design has hardly changed, I want you to see the above mentioned article for detailed explanation.

*** NOTICE *** In these photo, shell height is 40 mm. but you make shell height 55 mm.

Do not forget to make the height of the shell 55 mm.

When the shell dries, with the mesh head fixed, make a hole of 9 mm in diameter for the socket.

You can use butterfly nuts, but I also made tuning keys that can be tightened even with ordinary nuts, so please use it by all means.

For fixing the mesh head, use M6-70 mm bolts.

Once you've made a hole, remove the mesh head again to put a piezo

Step 6: Sponge Foam Sheets

Selection of materials is very important.

I used a sponge sheet made from 10 mm thick and 5 mm thick natural rubber.
I just bought it in the neighborhood DIY store, so I doubt if this is the best.

For trigger cones the best choice is to buy already molded ones. I decided to make it because I can not get it in my country, Japan.

It is not good if it is too hard or too soft. I am trying on various materials.

Step 7: Attaching Piezo

SNARE

In the case of a snare, use two piezo as shown in the picture.

Connect piezo's red cable to each of tip and ring.

Both black cables connect to sleeve.

Do not forget to thread the cables through the holes in the sensor plate when soldering.

Piezo for the head (piezo connected to tip) needs to be sandwiched with 10 mm thick sponge foam as shown in the picture.

One below, three on the top. And make the top 3 cones like the picture.

Then put it on the sensor plate.

KICK

Since the kick pad uses only one piezo, only tip can be used.

No sensor plate is required.Two sponge foams under the piezo

Place the sensor offset from the center.

It is because arduino can not judge the strength of hit if beater hits sensor directly.

HI-HAT

The circuit is the same as the kick pad.

Put a piece of 10 mm thick sponge foam under the piezo.


Piezo is delicate. Be careful not to bend or hurt.

Step 8: Snare Pad

First attach the sensor for the rim.

Fix the sensor plate. Firmly fix it. Make the end of the cone visible 2-3 mm when viewed from the side.

Of course, the same procedure is also used when using an 8-inch pad as a snare.

Step 9: 8 Inch Kick Pad

First, cut a 13 mm diameter stainless steel pipe.

Make two 200 mm and two 365 mm.

Since the length can be adjusted, even if there is some error in the length, it is OK.

Assemble them with reference to pictures.

In order to fix the pipe, it is designed so that the M3 nut can be loaded inside the part.

Fix the pipe securely. Use M3-15 mm bolts and nuts.

Step 10: Tom Mount (Extra)

Since I am planning to make a full set, I also designed a tom mount.

With this, you can use it with an actual drum.

Mount on the pole, but the diameter of the pole is different depending on the company. So, I prepared a model every 1 mm from 15 mm to 25 mm.

First, measure the diameter of the pole where you want to install the part. It would be good to print parts that are about 2 mm larger than its diameter and then tighten the bolts after sandwiching the plastic plate like a photo in the gap.

Step 11: 12 Inch Hi-Hat

After producing the shell with thick paper, I thought that if you use thick paper I can make cymbals.

First. Cut thick paper into a circle with a diameter of 300 mm. Make three of this.

Next, make a notch from the center.

Finally, a second notch is made from the point 10 mm apart parallel from the first notch.

In this way, three pac-mans with a small mouth opened are made.

Then close the Pac Man's mouth carefully with tape to make it into a cymbal shape.

Apply adhesive and overlay these.Do not forget to extend the adhesive cleanly and thinly

Hold firmly with your hands, then place the weight around and dry.

For silencing, put a 5 mm thick sponge and drill a hole. You can not open the hole neatly, but you can hide the hole so it's okay.

Complete by attaching sensor mount and cable guide with double-sided tape. It might be easier if you use glue gun.

Step 12: Hi-Hat Controller

Hi-Hat Controller sends the opening and closing of the hi-hat to arduino.

The circuit is very simple.

It is made by combining three parts.

Attach the FSR to the bottom part and fix the socket. FSR can be used even if a hole is opened.

Attach a 10 mm sponge to the FSR like a photo.

Fix the cover with M3 - 10 mm bolts.

Even though it's only HIGH and LOW, you may wonder why I used FSR.

I use FSR to correspond to sound modules such as Roland and Yamaha.

And in the sound source exclusive for drums such as EZ DRUMMER 2, there are several stages in the degree of opening of the hi-hat.

If it is FSR, it may be possible to respond by just modifying the code. However, I have not tried it.

Step 13: Play With Roland's Sound Module (Extra)

It is the easiest way to complete your own e-drum.

If you have a sound module, just connect it.

Even if you do not have one, you can get it second hand. I tried using Roland's TD-10. That's great.

Or you can use trigger to MIDI converter.(Roland TMC-6 or Alesis Trigger iO)

Do you want to make it yourself? Let's go to the next step.

Step 14: USB - MIDI

What can we do in this step?

With usb cable alone, you can send midi signal from arduino.

In other words, make arduino be recognized by iPhone etc. as a midi device without any additional hardware.

First of all, check this page.

http://morecatlab.akiba.coocan.jp/lab/index.php/aruino/midi-firmware-for-arduino-uno-moco/

https://github.com/kuwatay/mocolufa

If you connect normal arduino UNO directly to iPhone, you will get an error message like "Arduino UNO is not compatible".

So, you have to rewrite the USB chip (ATmega16U2) used in arduino UNO.

https://www.arduino.cc/en/Hacking/DFUProgramming8U2

This instruction is how to rewrite the hex file.

First, Download "dualMoco.hex" in your PC and move to Downloads.

Next,Please proceed according to this site until the description below.

[ sudo dfu-programmer atmega16u2 flash Arduino-usbserial-uno.hex ]

Just replace "Arduino-usbserial-uno.hex" with "dualMoco.hex".

Therefore,

[ sudo dfu-programmer atmega16u2 flash dualMoco.hex ]

After rewriting, your Arduino will be recognized as a MIDI device.

If you short-circuit the pin as shown in the picture, it will be recognized as normal Arduino.

If not (when not short-circuited), arduino UNO will be recognized as a MIDI device.

In other words, when writing code using the arduino IDE, you have to short-circuit the pins as shown in the picture.

Step 15: Using Hairless MIDI

If you think that the previous step is difficult, please try Hairless MIDI.

I wrote how to use it on my blog so please refer to it.

https://open-e-drums.tumblr.com/post/171304647319/using-hairless-midi

Step 16: Arduino Trigger MIDI Converter

There is arduino UNO and shield in the box.

Refer to the image of fritzing for the circuit of the shield.

Diodes are for protection but I saw the information that arduino UNO has protection circuit, diodes may not be necessary. Does anyone know about this?

Place the tact switch and toggle switch on a separate universal board. The size is "".

After printing the model of the case and the cover first, it is good to make the shield according to it.

There is also a 3D model of the cover, but I made a cover with a laser cutter. Please choose whichever you like. It would be good to put paper on the 3D printed cover.

Please see Step 10 for mounting on the pole and parts for it.

Step 17: Code

You can check the code on GitHub or Arduino Create

This code uses MIDI library and Liquid Crystal library.

I am a beginner in programming. This code can be improved further.

Step 18: Setting

In making the code, it was troublesome to rewrite the code each time the value changed, so I wanted to be able to change the value with arduino alone.

In other words, this is made for debugging code, so there are items that do not need to be changed.

Nevertheless, setting is necessary depending on the size of the piezo, the size of the pad, the hardness of the sponge foam.

Select an instrument with the inc / dec button and select the setting item with the next / back button. When the EDIT button is pressed while the instruments and items you want to set are displayed, you can change the value with the INC / DEC button. Then, pressing the EDIT button again confirms the change.

If you watch at the latter part of the video you will understand how to operate.

THRESHOLD

The lowest value at which sound comes out

SENSITIVITY

Sensor sensitivity. If you lower it, you will gain high velocity even if you hit softly.

NOTE

Number of the note. By changing, you can change instruments. Please refer to the image.

FLAG

A value for judging that the beating is over. You do not have to change it too much. It would be nice to set the value from 1 to 10. If you raise the value too much, you will get a sound twice with a single hit. If you lower it too much, you may get out of sound when you hit repeatedly.

SCAN TIME

In searching for peaks, values are taken consecutively for several milliseconds after exceeding the threshold. The highest value among them will peak. This several milliseconds is SCANTIME. There is no need to change it.

HEAD / RIM

Set the ease of the rim. Raising it makes it difficult to sound. If you lower it too hard the rim will sound when you hit the head. Regarding the judgment of the head and the rim, it may be necessary to improve the code

PEDAL VELO

Unlike other pads, the velocity of the pedal is constant. The initial value is 100. Please change to your favorite value.

MASK TIME

This is a value related to FLAG. There is no need to change it. If you raise it, you may not hear a sound when you hit continuously.

Step 19: Play With GrageBand

Just start garageband and connect. There is no particularly difficult setting.

I started making it to start drums. So please forgive my poor performance.

Step 20: Play With KORG Gadget Le

Korg Gadget has a drum machine in it. You can play just by connecting the same as garageband, but the note number is different.

There are 8 pads, assigned to those pads from 36 to 43 from the left.

You only need to edit the note number.

Step 21: Play With PC

There are a number of DAWs for PCs that can be used on this drum set, including GarageBand.

Among them, Hydrogen is free and you can add sound.

Especially difficult setting is unnecessary. Please connect in the same way as iPhone.

Step 22: Reference

A lot of information was very useful when making this drum set. Here, I will introduce them.

Step 23: Fusion 360 (Extra)

Some parts may not be usable unless their dimensions are changed. It is difficult to edit STL data. So I uploaded fusion 360 data. However, since I am editing data while trial and error, it is better not to depend too much on the history function.

https://github.com/RyoKosaka/drums/tree/master/Fusion360

Step 24: Processing (Extra)

I just tried making it experimentally.

I made it by Processing thinking that it would be fun if I could change the pad split position freely and export it with STL.

It would be fun if a 3D model was created simply by entering the size of the pad you want and the 3D printer you own.

Unfortunately, we can not actually export 3D models using this ...

It's just an experiment. Try playing.

You need a peasy library and controlP5 library

Step 25: Thank You for Reading.

There is still room for improvement. I decided to share it because I am over the hump with this production.

Surely, you think that this kit has too few pads.

Do not worry. Using arduino MEGA you can make exactly the same thing. If you just add more pads it will not be a big deal.Since analog pins are more than doubled, a fine drum set will be completed.

I am planning to make it, but I just started working. I will add pictures and codes when done.

Detailed production process is published on this blog. Check it if you are interested.

I am sorry it has become a very long instruction. Thank you so much for reading to the end.

Thank you so much, Arduino!

Thank you so much, RepRap!

Thank you so much, Roland and KORG and YAMAHA!

Thank you so much, Ikutaro Kakehashi!

Please feel free to ask anything.

Have fun!!!!!!

Step 26: Arduino Library

I created a library for Arduino.

Since it is still in beta, there may be bugs, but you can use it.

https://github.com/RyoKosaka/HelloDrum-arduino-Library

2 People Made This Project!

Recommendations

  • Woodworking Contest

    Woodworking Contest
  • Make it Move Contest

    Make it Move Contest
  • Casting Contest

    Casting Contest
user

We have a be nice policy.
Please be positive and constructive.

Tips

7 Questions

0

Hello Ryo Kosaka..you are such a talented and nice person by sharing this project..

currently i'm also working edrum on arduino..but instead using arduino mega, i'm using uno r3 with two 4051 multiplexer..is it possible to add lcd like you did at mine, so i can easily edit the note and else from there?since i don't understand c++, it is confusing for me.. :)

Here's my sketch ( i copied from someone who also share their project ) and using tcrt5000 instead fsr.

can you help me with this?thanks and sorry for asking you a lot..i really appreciete. And also since it's a project for my 3 yo kid, i really interested on it.. :)

unsigned char SensorType[16] = {144,176,144,144,144,144,144,144,144,144,144,144,144,144,144,144};

unsigned char PadNote[16] = {79,4,60,0,38,61,71,77,36,0,65,93,8,67,69,81};

unsigned char status;

int PadCutOff[16] = {175,250,200,200,175,185,200,250,700,200,200,175,200,200,200,200};

//int thresholdMin[16]={150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150};

//int thresholdMax[16]={1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023};

//int sensorScantime[16]={10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10};

//int sensorMasktime[16]={5,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90};

int MaxPlayTime[16] = {25,25,25,25,25,25,25,25,25,40,25,40,25,25,25,25};

#define midichannel 0;

boolean activePad[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};

int PinPlayTime[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};

boolean VelocityFlag = true;

int analogPin[2] = {A0,A1};

int pin = 0;

int hitavg = 0;

int nilai = 0;

int pad = 0;

int r0 = 0;

int r1 = 0;

int r2 = 0;

int count = 0;

int multiplex1[8];

int multiplex2[8];

//*******************************************************************************************************************

// Setup

//*******************************************************************************************************************

void setup()

{

pinMode(2, OUTPUT);

pinMode(3, OUTPUT);

pinMode(4, OUTPUT);

Serial.begin(115200); // connect to the serial port 57600

}

//*******************************************************************************************************************

// Main Program

//*******************************************************************************************************************

void loop(){

readSensors(0);

readSensors(1);

checkSensors(0);

checkSensors(1);

}

void readSensors (int analogPin) { //mulai baca Multiplex 4051

for(count=0; count <= 7; count++)

{

r2 = bitRead(count,0);

r1 = bitRead(count,1);

r0 = bitRead(count,2);

digitalWrite(2, r0);

digitalWrite(3, r1);

digitalWrite(4, r2);

if(analogPin==0) {

multiplex1[count] = analogRead(analogPin);

}

else if(analogPin==1) {

multiplex2[count] = analogRead(analogPin);

}

}

}

void checkSensors (int analogPin) {

for(int pin=0; pin <=7; pin++) {

if(analogPin==0) {

hitavg = multiplex1[pin];

nilai = multiplex1[pin];

pad=pin;

}

else if(analogPin==1) {

hitavg = multiplex2[pin];

pad=pin+8;

}

if((hitavg > PadCutOff[pad])) {

if((activePad[pad] == false)) {

if(VelocityFlag == true) {

hitavg = (hitavg / 8) -1;

//hitavg = 127 / ((1023 - PadCutOff[pad]) / (hitavg - PadCutOff[pad]));

nilai = (nilai / 8) -1;

}

else {

hitavg = 127;

}

if (SensorType[pin]==176 && PadNote[1]){//176 sensor tcrt5000

MIDI_CC(176,PadNote[1],nilai);

}

else{

MIDI_TX(144,PadNote[pad],hitavg);

PinPlayTime[pad] = 0;

activePad[pad] = true;

}

}

else {

PinPlayTime[pad] = PinPlayTime[pad] + 1;

}

}

else if((activePad[pad] == true)) {

PinPlayTime[pad] = PinPlayTime[pad] + 1;

if(PinPlayTime[pad] > MaxPlayTime[pad]) {

activePad[pad] = false;

MIDI_TX(128,PadNote[pad],0);

}

}

}

}

void MIDI_TX(unsigned char message, unsigned char pitch, unsigned char velocity) {

status = message + midichannel;

Serial.write(status);

Serial.write(pitch);

Serial.write(velocity);

}

void MIDI_CC(unsigned char message, unsigned char CC, unsigned char nilai) {

status = message + midichannel;

Serial.write(status);

Serial.write(CC);

Serial.write(nilai);

}

0

Ryo, i'm making the breadboard test... the LCD didn't turn on... i was checking the LCD basics, and the A and K pin must be connected. In your fritz schematic they aren't... is this an error or am i doing something wrong?

Captura de pantalla 2018-03-14 a la(s) 16.55.46.pngCaptura de pantalla 2018-03-14 a la(s) 16.55.59.png

Wiring published by Arduino official is correct. It would be my mistake. Since the code uses the library of the LCD, it should operate normally when the power of the LCD is turned on.

Greetings from Ukraine!))
I tried to make drum kit based on your project, but I got some problems... can you help me?
I used the arduino mega 2560 board with the same display 1602, so i did some changes in your code(just added few instruments) and in the settings menu I can see all of them except cymbals... can you check the code below and tell me where i made effort? and it will be great to make the settings able to save for using them after reboot. Thank you and sorry for bad english if any))
/*
" HELLO DRUM " Ver.1.0
Created June 28, 2017
by Ryo Kosaka
*/

////////////////////////////////////////// INITIAL VALUE ////////////////////////////////////////////

//{threshold, sensitivity, note, flag, velocity, peakValue}
//*** NOTICE *** peakValue and velocity must be zero.
//*** NOTICE *** Except for the notes, the hi-hat should have the same value for open and close.

int SNARE[6] = {150, 950, 38, 3, 0, 0};
int SNARE_RIM[6] = {5, 500, 71, 3 , 0, 0};
int HIGH_TOM[6] = {150, 950, 48, 3, 0, 0}; //possible editing needed
int MID_TOM[6] = {150, 950, 47, 3, 0, 0}; //possible editing needed
int LOW_TOM[6] = {150, 950, 45, 3, 0, 0}; //possible editing needed
int FLOOR_TOM[6] = {150, 950, 43, 3, 0, 0}; //possible editing needed
int FLOOR_TOM2[6] = {150, 950, 41, 3, 0, 0}; //possible editing needed
int LEFT_CRASH[6] = {100, 800, 49, 1, 0, 0};
int RIGHT_CRASH[6] = {100, 800, 57, 1, 0, 0};
int RIDE[6] = {100, 800, 51, 1, 0, 0};
int RIDE_BELL[6] = {100, 800, 53, 1, 0, 0};
int RIDE_EDGE[6] = {100, 800, 51, 1, 0, 0};
int CHINA[6] = {100, 800, 51, 1, 0, 0};
int HIHAT[6] = {100, 800, 46, 1, 0, 0};
int HIHAT_CLOSE[6] = {100, 800, 42, 1, 0, 0};
int KICK[6] = {200, 700, 36, 1, 0, 0};
int HIHAT_PEDAL[4] = {600, 0, 44, 0};
int SETTING[4] = {4, 500 ,100 ,1}; //{scantime, snare/rim, pedalVelocity , masktime}

/////////////////////////////////////////////////////////////////////////////////////////////////////////

#include
#include
LiquidCrystal lcd(8, 9, 4, 5, 6, 7); // lcd PIN
MIDI_CREATE_DEFAULT_INSTANCE();

boolean snareFlag = false;
boolean hightomFlag =false;
boolean midtomFlag = false;
boolean lowtomFlag = false;
boolean floortomFlag = false;
boolean floortom2Flag = false;
boolean leftcrashFlag = false;
boolean rightcrashFlag = false;
boolean rideFlag = false;
boolean ride_bellFlag = false;
boolean ride_edgeFlag = false;
boolean chinaFlag = false;
boolean hihatFlag = false;
boolean kickFlag = false;
boolean pedalFlag = false;
boolean buttonState = true;
boolean buttonState_set = true;
int UPDOWN = 0;
int NEXTBACK = 0;

void setup() {
MIDI.begin(10);
lcd.begin(16, 2);
lcd.print("hello world!");
lcd.setCursor(0, 1);
lcd.print("hello, drum!");
delay (3000);
pinMode(22, INPUT_PULLUP);
pinMode(3, INPUT_PULLUP);
pinMode(24, INPUT_PULLUP);
pinMode(2, INPUT_PULLUP);
pinMode(23, INPUT_PULLUP);
}

void loop() {

/////////////////////////////////// CIRCUIT ///////////////////////////////////////

int button_set = digitalRead(22);
int button_up = digitalRead(3);
int button_down = digitalRead(24);
int button_next = digitalRead(2);
int button_back = digitalRead(23);
int piezoValue_0 = analogRead(A0); //snare head
int piezoValue_1 = analogRead(A1); //snare rim
int piezoValue_2 = analogRead(A2); //high tom
int piezoValue_3 = analogRead(A3); //mid tom
int piezoValue_4 = analogRead(A4); //low tom
int piezoValue_5 = analogRead(A5); //floor tom
int piezoValue_6 = analogRead(A6); //floor tom 2
int piezoValue_7 = analogRead(A7); //left crash
int piezoValue_8 = analogRead(A8); //right crash
int piezoValue_9 = analogRead(A9); //ride
int piezoValue_10 = analogRead(A10); //ride bell
int piezoValue_11 = analogRead(A11); //ride edge
int piezoValue_12 = analogRead(A12); //hihat
int piezoValue_13 = analogRead(A13); //china
int piezoValue_14 = analogRead(A14); //kick
int fsrValue_0 = analogRead(A15); //hi-hat pedal


////////////////////////////////// EDIT MODE ////////////////////////////////////

int UP[4] = {5, 50, 1,1}; //{threshold, sensitivity, note, flag}
int UP_ADVANCE[4] = {1, 50, 1,1}; //{scantime, rim / head, pedal velocity ,masktime}

char* instrument[] = {
"SNARE HEAD", "SNARE RIM", "HIGH TOM",
"MID TOM", "LOW TOM", "FLOOR TOM", "FLOOR TOM 2",
"LEFT CRASH", "RIGHT CRASH", "RIDE",
"RIDE BELL", "RIDE EDGE", "CHINA", "HIHAT OPEN",
"HIHAT CLOSE", "HIHAT PEDAL", "KICK", "ADVANCED SETTING"
};

char* setting[] = {
"THRESHOLD", "SENSITIVITY", "NOTE", "FLAG"
};

char* setting_ADVANCE[] = {
"SCAN TIME", "HEAD / RIM ","PEDAL VELO", "MASK TIME"
};

if (UPDOWN
UPDOWN = 6;
}

if (UPDOWN > 6) {
UPDOWN = 0;
}

if (NEXTBACK
NEXTBACK = 3;
}

if (NEXTBACK > 3) {
NEXTBACK = 0;
}

////////////////////////////// EDIT BUTTON ////////////////////////////////

if (button_set == LOW && buttonState == true && buttonState_set == true) {
lcd.clear();
lcd.print("EDIT");
buttonState = false;
buttonState_set = false;
delay(500);
}

if (button_set == LOW && buttonState == true && buttonState_set == false) {
lcd.clear();
lcd.print("EDIT DONE");
buttonState = false;
buttonState_set = true;
delay(500);
}

if (button_up == LOW && buttonState == true && buttonState_set == false) {

switch (UPDOWN) {
case 0:
SNARE[NEXTBACK] = SNARE[NEXTBACK] + UP[NEXTBACK];
break;

case 1:
SNARE_RIM[NEXTBACK] = SNARE_RIM[NEXTBACK] + UP[NEXTBACK];
break;

case 2:
HIGH_TOM[NEXTBACK] = HIGH_TOM[NEXTBACK] + UP[NEXTBACK];
break;

case 3:
MID_TOM[NEXTBACK] = MID_TOM[NEXTBACK] + UP[NEXTBACK];
break;

case 4:
LOW_TOM[NEXTBACK] = LOW_TOM[NEXTBACK] + UP[NEXTBACK];
break;

case 5:
FLOOR_TOM[NEXTBACK] = FLOOR_TOM[NEXTBACK] + UP[NEXTBACK];
break;

case 6:
FLOOR_TOM2[NEXTBACK] = FLOOR_TOM2[NEXTBACK] + UP[NEXTBACK];
break;

case 7:
LEFT_CRASH[NEXTBACK] = LEFT_CRASH[NEXTBACK] + UP[NEXTBACK];
break;

case 8:
RIGHT_CRASH[NEXTBACK] = RIGHT_CRASH[NEXTBACK] + UP[NEXTBACK];
break;

case 9:
RIDE[NEXTBACK] = RIDE[NEXTBACK] + UP[NEXTBACK];
break;

case 10:
RIDE_BELL[NEXTBACK] = RIDE_BELL[NEXTBACK] + UP[NEXTBACK];
break;

case 11:
RIDE_EDGE[NEXTBACK] = RIDE_EDGE[NEXTBACK] + UP[NEXTBACK];
break;

case 12:
CHINA[NEXTBACK] = CHINA[NEXTBACK] + UP[NEXTBACK];
break;

case 13:
switch (NEXTBACK) {
case 13:
HIHAT[NEXTBACK] = HIHAT[NEXTBACK] + UP[NEXTBACK];
break;

default:
HIHAT_CLOSE[NEXTBACK] = HIHAT_CLOSE[NEXTBACK] + UP[NEXTBACK];
HIHAT[NEXTBACK] = HIHAT[NEXTBACK] + UP[NEXTBACK];
}
break;

case 14:
switch (NEXTBACK) {
case 13:
HIHAT_CLOSE[NEXTBACK] = HIHAT_CLOSE[NEXTBACK] + UP[NEXTBACK];
break;

default:
HIHAT_CLOSE[NEXTBACK] = HIHAT_CLOSE[NEXTBACK] + UP[NEXTBACK];
HIHAT[NEXTBACK] = HIHAT[NEXTBACK] + UP[NEXTBACK];
}
break;

case 15:
switch (NEXTBACK) {
case 0:
HIHAT_PEDAL[NEXTBACK] = HIHAT_PEDAL[NEXTBACK] + UP[NEXTBACK];
break;

case 2:
HIHAT_PEDAL[NEXTBACK] = HIHAT_PEDAL[NEXTBACK] + UP[NEXTBACK];
break;
}
break;

case 16:
KICK[NEXTBACK] = KICK[NEXTBACK] + UP[NEXTBACK];
break;

case 17:
SETTING[NEXTBACK] = SETTING[NEXTBACK] + UP_ADVANCE[NEXTBACK];
break;
}
buttonState = false;
delay(30);
}

if (button_down == LOW && buttonState == true && buttonState_set == false) {

switch (UPDOWN) {
case 0:
SNARE[NEXTBACK] = SNARE[NEXTBACK] - UP[NEXTBACK];
break;

case 1:
SNARE_RIM[NEXTBACK] = SNARE_RIM[NEXTBACK] - UP[NEXTBACK];
break;

case 2:
HIGH_TOM[NEXTBACK] = HIGH_TOM[NEXTBACK] - UP[NEXTBACK];
break;

case 3:
MID_TOM[NEXTBACK] = MID_TOM[NEXTBACK] - UP[NEXTBACK];
break;

case 4:
LOW_TOM[NEXTBACK] = LOW_TOM[NEXTBACK] - UP[NEXTBACK];
break;

case 5:
FLOOR_TOM[NEXTBACK] = FLOOR_TOM[NEXTBACK] - UP[NEXTBACK];
break;

case 6:
FLOOR_TOM2[NEXTBACK] = FLOOR_TOM2[NEXTBACK] - UP[NEXTBACK];
break;

case 7:
LEFT_CRASH[NEXTBACK] = LEFT_CRASH[NEXTBACK] - UP[NEXTBACK];
break;

case 8:
RIGHT_CRASH[NEXTBACK] = RIGHT_CRASH[NEXTBACK] - UP[NEXTBACK];
break;

case 9:
RIDE[NEXTBACK] = RIDE[NEXTBACK] - UP[NEXTBACK];
break;

case 10:
RIDE_BELL[NEXTBACK] = RIDE_BELL[NEXTBACK] - UP[NEXTBACK];
break;

case 11:
RIDE_EDGE[NEXTBACK] = RIDE_EDGE[NEXTBACK] - UP[NEXTBACK];
break;

case 12:
CHINA[NEXTBACK] = CHINA[NEXTBACK] - UP[NEXTBACK];
break;

case 13:
switch (NEXTBACK) {
case 13:
HIHAT[NEXTBACK] = HIHAT[NEXTBACK] - UP[NEXTBACK];
break;

default:
HIHAT_CLOSE[NEXTBACK] = HIHAT_CLOSE[NEXTBACK] - UP[NEXTBACK];
HIHAT[NEXTBACK] = HIHAT[NEXTBACK] - UP[NEXTBACK];
}
break;

case 14:
switch (NEXTBACK) {
case 13:
HIHAT_CLOSE[NEXTBACK] = HIHAT_CLOSE[NEXTBACK] - UP[NEXTBACK];
break;

default:
HIHAT_CLOSE[NEXTBACK] = HIHAT_CLOSE[NEXTBACK] - UP[NEXTBACK];
HIHAT[NEXTBACK] = HIHAT[NEXTBACK] - UP[NEXTBACK];
}
break;

case 15:
switch (NEXTBACK) {
case 0:
HIHAT_PEDAL[NEXTBACK] = HIHAT_PEDAL[NEXTBACK] - UP[NEXTBACK];
break;

case 2:
HIHAT_PEDAL[NEXTBACK] = HIHAT_PEDAL[NEXTBACK] - UP[NEXTBACK];
break;
}
break;

case 16:
KICK[NEXTBACK] = KICK[NEXTBACK] - UP[NEXTBACK];
break;

case 17:
SETTING[NEXTBACK] = SETTING[NEXTBACK] - UP_ADVANCE[NEXTBACK];
break;
}
buttonState = false;
delay(30);
}

///////////////////////////// UP DOWN NEXT BACK ////////////////////////////////

if (button_up == LOW && buttonState == true && buttonState_set == true) {
UPDOWN = ++UPDOWN;
buttonState = false;
delay(30);
}

if (button_down == LOW && buttonState == true && buttonState_set == true) {
UPDOWN = --UPDOWN;
buttonState = false;
delay(30);
}

if (button_next == LOW && buttonState == true && buttonState_set == true) {
NEXTBACK = ++NEXTBACK;
buttonState = false;
delay(30);
}

if (button_back == LOW && buttonState == true && buttonState_set == true) {
NEXTBACK = --NEXTBACK;
buttonState = false;
delay(30);
}

if (buttonState == false && button_up == HIGH && button_down == HIGH && button_next == HIGH && button_back == HIGH && button_set == HIGH) {
switch (UPDOWN) {
case 0:
lcd.clear();
lcd.print(instrument[UPDOWN]);
lcd.setCursor(0, 1);
lcd.print(setting[NEXTBACK]);
lcd.setCursor(12, 1);
lcd.print(SNARE[NEXTBACK]);
break;

case 1:
lcd.clear();
lcd.print(instrument[UPDOWN]);
lcd.setCursor(0, 1);
lcd.print(setting[NEXTBACK]);
lcd.setCursor(12, 1);
lcd.print(SNARE_RIM[NEXTBACK]);
break;

case 2:
lcd.clear();
lcd.print(instrument[UPDOWN]);
lcd.setCursor(0, 1);
lcd.print(setting[NEXTBACK]);
lcd.setCursor(12, 1);
lcd.print(HIGH_TOM[NEXTBACK]);
break;

case 3:
lcd.clear();
lcd.print(instrument[UPDOWN]);
lcd.setCursor(0, 1);
lcd.print(setting[NEXTBACK]);
lcd.setCursor(12, 1);
lcd.print(MID_TOM[NEXTBACK]);
break;

case 4:
lcd.clear();
lcd.print(instrument[UPDOWN]);
lcd.setCursor(0, 1);
lcd.print(setting[NEXTBACK]);
lcd.setCursor(12, 1);
lcd.print(LOW_TOM[NEXTBACK]);
break;

case 5:
lcd.clear();
lcd.print(instrument[UPDOWN]);
lcd.setCursor(0, 1);
lcd.print(setting[NEXTBACK]);
lcd.setCursor(12, 1);
lcd.print(FLOOR_TOM[NEXTBACK]);
break;

case 6:
lcd.clear();
lcd.print(instrument[UPDOWN]);
lcd.setCursor(0, 1);
lcd.print(setting[NEXTBACK]);
lcd.setCursor(12, 1);
lcd.print(FLOOR_TOM2[NEXTBACK]);
break;

case 7:
lcd.clear();
lcd.print(instrument[UPDOWN]);
lcd.setCursor(0, 1);
lcd.print(setting[NEXTBACK]);
lcd.setCursor(12, 1);
lcd.print(LEFT_CRASH[NEXTBACK]);
break;

case 8:
lcd.clear();
lcd.print(instrument[UPDOWN]);
lcd.setCursor(0, 1);
lcd.print(setting[NEXTBACK]);
lcd.setCursor(12, 1);
lcd.print(RIGHT_CRASH[NEXTBACK]);
break;

case 9:
lcd.clear();
lcd.print(instrument[UPDOWN]);
lcd.setCursor(0, 1);
lcd.print(setting[NEXTBACK]);
lcd.setCursor(12, 1);
lcd.print(RIDE[NEXTBACK]);
break;

case 10:
lcd.clear();
lcd.print(instrument[UPDOWN]);
lcd.setCursor(0, 1);
lcd.print(setting[NEXTBACK]);
lcd.setCursor(12, 1);
lcd.print(RIDE_BELL[NEXTBACK]);
break;

case 11:
lcd.clear();
lcd.print(instrument[UPDOWN]);
lcd.setCursor(0, 1);
lcd.print(setting[NEXTBACK]);
lcd.setCursor(12, 1);
lcd.print(RIDE_EDGE[NEXTBACK]);
break;

case 12:
lcd.clear();
lcd.print(instrument[UPDOWN]);
lcd.setCursor(0, 1);
lcd.print(setting[NEXTBACK]);
lcd.setCursor(12, 1);
lcd.print(CHINA[NEXTBACK]);

case 13:
lcd.clear();
lcd.print(instrument[UPDOWN]);
lcd.setCursor(0, 1);
lcd.print(setting[NEXTBACK]);
lcd.setCursor(12, 1);
lcd.print(HIHAT[NEXTBACK]);
break;

case 14:
lcd.clear();
lcd.print(instrument[UPDOWN]);
lcd.setCursor(0, 1);
lcd.print(setting[NEXTBACK]);
lcd.setCursor(12, 1);
lcd.print(HIHAT_CLOSE[NEXTBACK]);
break;

case 15:
lcd.clear();
lcd.print(instrument[UPDOWN]);
lcd.setCursor(0, 1);
lcd.print(setting[NEXTBACK]);
lcd.setCursor(12, 1);
lcd.print(HIHAT_PEDAL[NEXTBACK]);
break;

case 16:
lcd.clear();
lcd.print(instrument[UPDOWN]);
lcd.setCursor(0, 1);
lcd.print(setting[NEXTBACK]);
lcd.setCursor(12, 1);
lcd.print(KICK[NEXTBACK]);
break;


case 17:
lcd.clear();
lcd.print(instrument[UPDOWN]);
lcd.setCursor(0, 1);
lcd.print(setting_ADVANCE[NEXTBACK]);
lcd.setCursor(12, 1);
lcd.print(SETTING[NEXTBACK]);
break;
}
buttonState = true;
}

////////////////////////////////// SNARE ///////////////////////////////////

if (piezoValue_0 > SNARE[0] && snareFlag == false) {

for (int i = 0; i int peak0 = analogRead(A0);
int peak1 = analogRead(A1);
delay(1);

if (peak0 > SNARE[4]) {
SNARE[4] = peak0;
}

if (peak1 > SNARE_RIM[4]) {
SNARE_RIM[4] = peak1;
}
}

SNARE[5] = SNARE[4];
SNARE_RIM[5] = SNARE_RIM[4];
SNARE[4] = map(SNARE[4], SNARE[0], SNARE[1], 0, 127);
SNARE_RIM[4] = map(SNARE_RIM[4], SNARE_RIM[0], SNARE_RIM[1], 0, 127);
SNARE[4] = ( SNARE[4] * SNARE[4]) / 127; // Curve setting
//SNARE_RIM[4] = (SNARE_RIM[4] * SNARE_RIM[4]) / 127;

if (SNARE[4]
SNARE[4] = 1;
}

if (SNARE[4] > 127) {
SNARE[4] = 127;
}

if (SNARE_RIM[4]
SNARE_RIM[4] = 0;
}

if (SNARE_RIM[4] > 127) {
SNARE_RIM[4] = 127;
}

if (SNARE_RIM[5] > SETTING[1]) {
MIDI.sendNoteOn(SNARE_RIM[2], SNARE_RIM[4], 1); //(note, velocity, channel)
MIDI.sendNoteOn(SNARE_RIM[2], 0, 1);
lcd.clear();
lcd.print("SNARE RIM");
lcd.setCursor(0, 1);
lcd.print(SNARE_RIM[4]);
snareFlag = true;
}

//else if (SNARE[5] > SNARE_RIM[5])
else {
MIDI.sendNoteOn(SNARE[2], SNARE[4], 1); //(note, velocity, channel)
MIDI.sendNoteOn(SNARE[2], 0, 1);
lcd.clear();
lcd.print("SNARE HEAD");
lcd.setCursor(0, 1);
lcd.print(SNARE[4]);
// lcd.setCursor(10, 1);
// lcd.print(SNARE_RIM[5]);
snareFlag = true;
}
}

//////////////////////////////////// HIGH TOM //////////////////////////////////

if (piezoValue_2 > HIGH_TOM[0] && midtomFlag == false) {

for (int i = 0; i int peak2 = analogRead(A2);
delay(1);

if (peak2 > HIGH_TOM[4]) {
HIGH_TOM[4] = peak2;
}
}

HIGH_TOM[5] = HIGH_TOM[4];
HIGH_TOM[4] = map(HIGH_TOM[4], HIGH_TOM[0], HIGH_TOM[1], 0, 127);
HIGH_TOM[4] = (HIGH_TOM[4] * HIGH_TOM[4]) / 127;

if (HIGH_TOM[4]
HIGH_TOM[4] = 1;
}

if (HIGH_TOM[4] > 127) {
HIGH_TOM[4] = 127;
}

MIDI.sendNoteOn(HIGH_TOM[2], HIGH_TOM[4], 1);
MIDI.sendNoteOn(HIGH_TOM[2], 0, 1);
lcd.clear();
lcd.print("HIGH TOM");
lcd.setCursor(0, 1);
lcd.print(HIGH_TOM[4]);
hightomFlag = true;
}
//////////////////////////////////// MID TOM //////////////////////////////////

if (piezoValue_3 > MID_TOM[0] && midtomFlag == false) {

for (int i = 0; i int peak3 = analogRead(A3);
delay(1);

if (peak3 > MID_TOM[4]) {
MID_TOM[4] = peak3;
}
}

MID_TOM[5] = MID_TOM[4];
MID_TOM[4] = map(MID_TOM[4], MID_TOM[0], MID_TOM[1], 0, 127);
MID_TOM[4] = (MID_TOM[4] * MID_TOM[4]) / 127;

if (MID_TOM[4]
MID_TOM[4] = 1;
}

if (MID_TOM[4] > 127) {
MID_TOM[4] = 127;
}

MIDI.sendNoteOn(MID_TOM[2], MID_TOM[4], 1);
MIDI.sendNoteOn(MID_TOM[2], 0, 1);
lcd.clear();
lcd.print("MID TOM");
lcd.setCursor(0, 1);
lcd.print(MID_TOM[4]);
midtomFlag = true;
}

//////////////////////////////////// LOW TOM //////////////////////////////////

if (piezoValue_4 > LOW_TOM[0] && lowtomFlag == false) {

for (int i = 0; i int peak4 = analogRead(A4);
delay(1);

if (peak4 > LOW_TOM[4]) {
MID_TOM[4] = peak4;
}
}

LOW_TOM[5] = LOW_TOM[4];
LOW_TOM[4] = map(LOW_TOM[4], LOW_TOM[0], LOW_TOM[1], 0, 127);
LOW_TOM[4] = (LOW_TOM[4] * LOW_TOM[4]) / 127;

if (LOW_TOM[4]
LOW_TOM[4] = 1;
}

if (LOW_TOM[4] > 127) {
LOW_TOM[4] = 127;
}

MIDI.sendNoteOn(LOW_TOM[2], LOW_TOM[4], 1);
MIDI.sendNoteOn(LOW_TOM[2], 0, 1);
lcd.clear();
lcd.print("LOW TOM");
lcd.setCursor(0, 1);
lcd.print(LOW_TOM[4]);
lowtomFlag = true;
}

//////////////////////////////////// FLOOR TOM //////////////////////////////////

if (piezoValue_5 > FLOOR_TOM[0] && floortomFlag == false) {

for (int i = 0; i int peak5 = analogRead(A5);
delay(1);

if (peak5 > FLOOR_TOM[4]) {
FLOOR_TOM[4] = peak5;
}
}

FLOOR_TOM[5] = FLOOR_TOM[4];
FLOOR_TOM[4] = map(FLOOR_TOM[4], FLOOR_TOM[0], FLOOR_TOM[1], 0, 127);
FLOOR_TOM[4] = (FLOOR_TOM[4] * FLOOR_TOM[4]) / 127;

if (FLOOR_TOM[4]
FLOOR_TOM[4] = 1;
}

if (FLOOR_TOM[4] > 127) {
FLOOR_TOM[4] = 127;
}

MIDI.sendNoteOn(FLOOR_TOM[2], FLOOR_TOM[4], 1);
MIDI.sendNoteOn(FLOOR_TOM[2], 0, 1);
lcd.clear();
lcd.print("FLOOR TOM");
lcd.setCursor(0, 1);
lcd.print(FLOOR_TOM[4]);
floortomFlag = true;
}
//////////////////////////////////// FLOOR TOM //////////////////////////////////

if (piezoValue_6 > FLOOR_TOM2[0] && floortom2Flag == false) {

for (int i = 0; i int peak6 = analogRead(A6);
delay(1);

if (peak6 > FLOOR_TOM2[4]) {
FLOOR_TOM[4] = peak6;
}
}

FLOOR_TOM2[5] = FLOOR_TOM2[4];
FLOOR_TOM2[4] = map(FLOOR_TOM2[4], FLOOR_TOM2[0], FLOOR_TOM2[1], 0, 127);
FLOOR_TOM2[4] = (FLOOR_TOM2[4] * FLOOR_TOM2[4]) / 127;

if (FLOOR_TOM2[4]
FLOOR_TOM2[4] = 1;
}

if (FLOOR_TOM2[4] > 127) {
FLOOR_TOM2[4] = 127;
}

MIDI.sendNoteOn(FLOOR_TOM2[2], FLOOR_TOM2[4], 1);
MIDI.sendNoteOn(FLOOR_TOM2[2], 0, 1);
lcd.clear();
lcd.print("FLOOR TOM2");
lcd.setCursor(0, 1);
lcd.print(FLOOR_TOM2[4]);
floortom2Flag = true;
}
//////////////////////////////////// LEFT CRASH //////////////////////////////////

if (piezoValue_7 > LEFT_CRASH[0] && floortom2Flag == false) {

for (int i = 0; i int peak7 = analogRead(A7);
delay(1);

if (peak7 > LEFT_CRASH[4]) {
LEFT_CRASH[4] = peak7;
}
}

LEFT_CRASH[5] = LEFT_CRASH[4];
LEFT_CRASH[4] = map(LEFT_CRASH[4], LEFT_CRASH[0], LEFT_CRASH[1], 0, 127);
LEFT_CRASH[4] = (LEFT_CRASH[4] * LEFT_CRASH[4]) / 127;

if (LEFT_CRASH[4]
LEFT_CRASH[4] = 1;
}

if (LEFT_CRASH[4] > 127) {
LEFT_CRASH[4] = 127;
}

MIDI.sendNoteOn(LEFT_CRASH[2], LEFT_CRASH[4], 1);
MIDI.sendNoteOn(LEFT_CRASH[2], 0, 1);
lcd.clear();
lcd.print("LEFT CRASH");
lcd.setCursor(0, 1);
lcd.print(LEFT_CRASH[4]);
leftcrashFlag = true;
}
//////////////////////////////////// RIGHT CRASH //////////////////////////////////

if (piezoValue_8 > RIGHT_CRASH[0] && rightcrashFlag == false) {

for (int i = 0; i int peak8 = analogRead(A8);
delay(1);

if (peak8 > RIGHT_CRASH[4]) {
RIGHT_CRASH[4] = peak8;
}
}

RIGHT_CRASH[5] = RIGHT_CRASH[4];
RIGHT_CRASH[4] = map(RIGHT_CRASH[4], RIGHT_CRASH[0], RIGHT_CRASH[1], 0, 127);
RIGHT_CRASH[4] = (RIGHT_CRASH[4] * RIGHT_CRASH[4]) / 127;

if (RIGHT_CRASH[4]
RIGHT_CRASH[4] = 1;
}

if (RIGHT_CRASH[4] > 127) {
RIGHT_CRASH[4] = 127;
}

MIDI.sendNoteOn(RIGHT_CRASH[2], RIGHT_CRASH[4], 1);
MIDI.sendNoteOn(RIGHT_CRASH[2], 0, 1);
lcd.clear();
lcd.print("RIGHT CRASH");
lcd.setCursor(0, 1);
lcd.print(RIGHT_CRASH[4]);
rightcrashFlag = true;
}

//////////////////////////////////// RIDE//////////////////////////////////

if (piezoValue_9 > RIDE[0] && rideFlag == false) {

for (int i = 0; i int peak9 = analogRead(A9);
delay(1);

if (peak9 > RIDE[4]) {
RIDE[4] = peak9;
}
}

RIDE[5] = RIDE[4];
RIDE[4] = map(RIDE[4], RIDE[0], RIDE[1], 0, 127);
RIDE[4] = (RIDE[4] * RIDE[4]) / 127;

if (RIDE[4]
RIDE[4] = 1;
}

if (RIDE[4] > 127) {
RIDE[4] = 127;
}

MIDI.sendNoteOn(RIDE[2], RIDE[4], 1);
MIDI.sendNoteOn(RIDE[2], 0, 1);
lcd.clear();
lcd.print("RIDE");
lcd.setCursor(0, 1);
lcd.print(RIDE[4]);
rideFlag = true;
}

//////////////////////////////////// RIDE BELL//////////////////////////////////

if (piezoValue_10 > RIDE_BELL[0] && ride_bellFlag == false) {

for (int i = 0; i int peak10 = analogRead(A10);
delay(1);

if (peak10 > RIDE_BELL[4]) {
RIDE_BELL[4] = peak10;
}
}

RIDE_BELL[5] = RIDE_BELL[4];
RIDE_BELL[4] = map(RIDE_BELL[4], RIDE_BELL[0], RIDE_BELL[1], 0, 127);
RIDE_BELL[4] = (RIDE_BELL[4] * RIDE_BELL[4]) / 127;

if (RIDE_BELL[4]
RIDE_BELL[4] = 1;
}

if (RIDE_BELL[4] > 127) {
RIDE_BELL[4] = 127;
}

MIDI.sendNoteOn(RIDE_BELL[2], RIDE_BELL[4], 1);
MIDI.sendNoteOn(RIDE_BELL[2], 0, 1);
lcd.clear();
lcd.print("RIDE BELL");
lcd.setCursor(0, 1);
lcd.print(RIDE_BELL[4]);
ride_bellFlag = true;
}

//////////////////////////////////// RIDE EDGE//////////////////////////////////

if (piezoValue_11 > RIDE_EDGE[0] && ride_edgeFlag == false) {

for (int i = 0; i int peak11 = analogRead(A11);
delay(1);

if (peak11 > RIDE_EDGE[4]) {
RIDE[4] = peak11;
}
}

RIDE_EDGE[5] = RIDE_EDGE[4];
RIDE_EDGE[4] = map(RIDE_EDGE[4], RIDE_EDGE[0], RIDE_EDGE[1], 0, 127);
RIDE_EDGE[4] = (RIDE_EDGE[4] * RIDE_EDGE[4]) / 127;

if (RIDE_EDGE[4]
RIDE_EDGE[4] = 1;
}

if (RIDE_EDGE[4] > 127) {
RIDE_EDGE[4] = 127;
}

MIDI.sendNoteOn(RIDE_EDGE[2], RIDE_EDGE[4], 1);
MIDI.sendNoteOn(RIDE_EDGE[2], 0, 1);
lcd.clear();
lcd.print("RIDE EDGE");
lcd.setCursor(0, 1);
lcd.print(RIDE_EDGE[4]);
ride_edgeFlag = true;
}

//////////////////////////////////// CHINA //////////////////////////////////

if (piezoValue_13 > CHINA[0] && chinaFlag == false) {

for (int i = 0; i int peak13 = analogRead(A13);
delay(1);

if (peak13 > RIDE_EDGE[4]) {
RIDE[4] = peak13;
}
}

CHINA[5] = CHINA[4];
CHINA[4] = map(CHINA[4], CHINA[0], CHINA[1], 0, 127);
CHINA[4] = (CHINA[4] * CHINA[4]) / 127;

if (CHINA[4]
CHINA[4] = 1;
}

if (CHINA[4] > 127) {
CHINA[4] = 127;
}

MIDI.sendNoteOn(CHINA[2], CHINA[4], 1);
MIDI.sendNoteOn(CHINA[2], 0, 1);
lcd.clear();
lcd.print("CHINA");
lcd.setCursor(0, 1);
lcd.print(CHINA[4]);
chinaFlag = true;
}
//////////////////////////////// HI-HAT /////////////////////////////////////

if (piezoValue_12 > HIHAT[0] && hihatFlag == false) {

for (int i = 0; i int peak2 = analogRead(A12);
delay(1);

if (peak2 > HIHAT[4]) {
HIHAT[4] = peak2;
}
}

HIHAT[5] = HIHAT[4];
HIHAT[4] = map(HIHAT[4], HIHAT[0], HIHAT[1], 0, 127);
HIHAT[4] = (HIHAT[4] * HIHAT[4]) / 127;

if (HIHAT[4]
HIHAT[4] = 1;
}

if (HIHAT[4] > 127) {
HIHAT[4] = 127;
}

if (fsrValue_0 MIDI.sendNoteOn(HIHAT[2], HIHAT[4], 1);
MIDI.sendNoteOn(HIHAT[2], 0, 1);
lcd.clear();
lcd.print("HIHAT OPEN");
lcd.setCursor(0, 1);
lcd.print(HIHAT[4]);
hihatFlag = true;
}

else if (fsrValue_0 >= HIHAT_PEDAL[0]) {
MIDI.sendNoteOn(HIHAT_CLOSE[2], HIHAT[4], 1);
MIDI.sendNoteOn(HIHAT_CLOSE[2], 0, 1);
lcd.clear();
lcd.print("HIHAT CLOSE");
lcd.setCursor(0, 1);
lcd.print(HIHAT[4]);
hihatFlag = true;
}
}

//////////////////////////////////// KICK //////////////////////////////////

if (piezoValue_14 > KICK[0] && kickFlag == false) {

for (int i = 0; i int peak14 = analogRead(A14);
delay(1);

if (peak14 > KICK[4]) {
KICK[4] = peak14;
}
}

KICK[5] = KICK[4];
KICK[4] = map(KICK[4], KICK[0], KICK[1], 0, 127);
KICK[4] = (KICK[4] * KICK[4]) / 127;

if (KICK[4]
KICK[4] = 1;
}

if (KICK[4] > 127) {
KICK[4] = 127;
}

MIDI.sendNoteOn(KICK[2], KICK[4], 1);
MIDI.sendNoteOn(KICK[2], 0, 1);
lcd.clear();
lcd.print("KICK");
lcd.setCursor(0, 1);
lcd.print(KICK[4]);
kickFlag = true;
}

///////////////////////////// HIHAT PEDAL ////////////////////////////

if (fsrValue_0 > HIHAT_PEDAL[0] && pedalFlag == false) {
MIDI.sendNoteOn(HIHAT_PEDAL[2], SETTING[2], 1); //(note, velocity, channel)
MIDI.sendNoteOn(HIHAT_PEDAL[2], 0, 1);
lcd.clear();
lcd.print("HIHAT PEDAL");
lcd.setCursor(0, 1);
lcd.print(SETTING[2]);
pedalFlag = true;
}

////////////////////////////// FLAG /////////////////////////////

if (piezoValue_0 delay(SETTING[3]); //mask time
int sensorValue0 = analogRead(A0);
if (sensorValue0 snareFlag = false;
}
}

if (piezoValue_1 delay(SETTING[3]); //mask time
int sensorValue1 = analogRead(A1);
if (sensorValue1 snareFlag = false;
}
}

if (piezoValue_2 delay(SETTING[3]); //mask time
int sensorValue2 = analogRead(A2);
if (sensorValue2 hightomFlag = false;
}
}

if (piezoValue_3 delay(SETTING[3]); //mask time
int sensorValue3 = analogRead(A3);
if (sensorValue3 midtomFlag = false;
}
}

if (piezoValue_4 delay(SETTING[3]); //mask time
int sensorValue4 = analogRead(A4);
if (sensorValue4 lowtomFlag = false;
}
}
if (piezoValue_5 delay(SETTING[3]); //mask time
int sensorValue5 = analogRead(A5);
if (sensorValue5 floortomFlag = false;
}
}
if (piezoValue_6 delay(SETTING[3]); //mask time
int sensorValue6 = analogRead(A6);
if (sensorValue6 floortom2Flag = false;
}
}
if (piezoValue_7 delay(SETTING[3]); //mask time
int sensorValue7 = analogRead(A7);
if (sensorValue7 leftcrashFlag = false;
}
}
if (piezoValue_8 delay(SETTING[3]); //mask time
int sensorValue8 = analogRead(A8);
if (sensorValue8 rightcrashFlag = false;
}
}
if (piezoValue_9 delay(SETTING[3]); //mask time
int sensorValue9 = analogRead(A9);
if (sensorValue9 rideFlag = false;
}
}

if (piezoValue_10 delay(SETTING[3]); //mask time
int sensorValue10 = analogRead(A10);
if (sensorValue10 ride_bellFlag = false;
}
}

if (piezoValue_11 delay(SETTING[3]); //mask time
int sensorValue11 = analogRead(A11);
if (sensorValue11 ride_edgeFlag = false;
}
}

if (fsrValue_0 delay(SETTING[3]);
int sensorValue12 = analogRead(A12);
if (sensorValue12 hihatFlag = false;
}
}

if (fsrValue_0 >= HIHAT_PEDAL[0] && piezoValue_12 delay(SETTING[3]);
int sensorValue12 = analogRead(A12);
if (sensorValue12 hihatFlag = false;
}
}

if (piezoValue_13 delay(SETTING[3]); //mask time
int sensorValue13 = analogRead(A13);
if (sensorValue13 chinaFlag = false;
}
}
if (piezoValue_14 delay(SETTING[3]);
int sensorValue14 = analogRead(A14);
if (piezoValue_14 kickFlag = false;
}
}

if ( fsrValue_0 pedalFlag = false;
}
}

Hello! I am sorry that the reply was delayed. EDIT MODE will be a problem if the setting on the LCD is not good. Please fix as follows.

if (UPDOWN

UPDOWN = 17;
}

if (UPDOWN > 17) {
UPDOWN = 0;
}

Great. I want to watch a video! But I can not see because I am not a member of that Facebook group.

0

Hi Ryo, i got another question, it may be obvious but since i'm very new to this i better ask: The red cables of the piezo go to the red cable of the jack? and the black cable of the piezo goes to the blue cable of the jack?? because in frtizing they are not connected and for me is a little confusing.

Captura de pantalla 2018-03-15 a la(s) 20.53.46.png

Yes. That's right.

0

Also, trying to verify the code before writing it to the arduino board and got this error messages:

/Users/jair/Desktop/Arduino/Midi Drums/02 Ryo Kosaka - MINIMAL DRUM KIT/HELLODRUM/HELLODRUM.ino: In function 'void loop()':

/Users/jair/Desktop/Arduino/Midi Drums/02 Ryo Kosaka - MINIMAL DRUM KIT/HELLODRUM/HELLODRUM.ino:76:3: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

};

^

/Users/jair/Desktop/Arduino/Midi Drums/02 Ryo Kosaka - MINIMAL DRUM KIT/HELLODRUM/HELLODRUM.ino:76:3: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

/Users/jair/Desktop/Arduino/Midi Drums/02 Ryo Kosaka - MINIMAL DRUM KIT/HELLODRUM/HELLODRUM.ino:76:3: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

/Users/jair/Desktop/Arduino/Midi Drums/02 Ryo Kosaka - MINIMAL DRUM KIT/HELLODRUM/HELLODRUM.ino:76:3: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

/Users/jair/Desktop/Arduino/Midi Drums/02 Ryo Kosaka - MINIMAL DRUM KIT/HELLODRUM/HELLODRUM.ino:76:3: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

/Users/jair/Desktop/Arduino/Midi Drums/02 Ryo Kosaka - MINIMAL DRUM KIT/HELLODRUM/HELLODRUM.ino:76:3: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

/Users/jair/Desktop/Arduino/Midi Drums/02 Ryo Kosaka - MINIMAL DRUM KIT/HELLODRUM/HELLODRUM.ino:76:3: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

/Users/jair/Desktop/Arduino/Midi Drums/02 Ryo Kosaka - MINIMAL DRUM KIT/HELLODRUM/HELLODRUM.ino:80:3: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

};

^

/Users/jair/Desktop/Arduino/Midi Drums/02 Ryo Kosaka - MINIMAL DRUM KIT/HELLODRUM/HELLODRUM.ino:80:3: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

/Users/jair/Desktop/Arduino/Midi Drums/02 Ryo Kosaka - MINIMAL DRUM KIT/HELLODRUM/HELLODRUM.ino:80:3: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

/Users/jair/Desktop/Arduino/Midi Drums/02 Ryo Kosaka - MINIMAL DRUM KIT/HELLODRUM/HELLODRUM.ino:80:3: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

/Users/jair/Desktop/Arduino/Midi Drums/02 Ryo Kosaka - MINIMAL DRUM KIT/HELLODRUM/HELLODRUM.ino:84:3: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

};

^

/Users/jair/Desktop/Arduino/Midi Drums/02 Ryo Kosaka - MINIMAL DRUM KIT/HELLODRUM/HELLODRUM.ino:84:3: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

/Users/jair/Desktop/Arduino/Midi Drums/02 Ryo Kosaka - MINIMAL DRUM KIT/HELLODRUM/HELLODRUM.ino:84:3: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

/Users/jair/Desktop/Arduino/Midi Drums/02 Ryo Kosaka - MINIMAL DRUM KIT/HELLODRUM/HELLODRUM.ino:84:3: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

0

Thanks for answering Ryo, i'm very new to arduino, like 1 week new :) i'll give it my best to learn quickly, i want to make this project for my band. Greetings

Comments