How can i do that in arduino mega and use all pieces of drums in garage band? Privacy Policy Build Your Own Electronic Drum Kit Using an Arduino Mega: This project shows building an electronic drum kit using Arduino mega. Most Arduino based drum kits use the Arduino as input listener and midi controller for a connected midi sound device. 4. I am using YAMAHA HS650A), ・Kick pedal (Anything is OK. You do not have to change it too much. Sure, you could buy a clock or just use your phone, but if you build Dejan Nedelkovski’s Arduino-b Do you know what I should do if I want to add cymbals? on Step 15, hello bro, please help meWhen I jumper the Arduino Mega2560, my Arduino unkown the device on the computer, Question This includes the circuit board, resistors, diodes and pins. The code uses the digital (and some analog) ports as GPIO to detect the drumpad hits, and the digital ports 0-7 (PORTD) are connected to a 8-bit R2R DAC. 2. If you’d like to save some money on a drum kit, this one is made using an Arduino Mega, MDF, and even a left sandal! I apologize in advance that English is not my first language, ・16 x 2 LCD (I do not use this same thing, but this will be fine. Duct tape. ))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? By changing, you can change instruments. 1 year ago. (Roland TMC-6 or Alesis Trigger iO). Hi-Hat Controller sends the opening and closing of the hi-hat to arduino. If you need to get up for work, class, or simply to avoid wasting the day away, setting an alarm is the obvious solution. 1 year ago. Place the tact switch and toggle switch on a separate universal board. Use M3-15 mm bolts and nuts. When a drumpad is hit, the line goes to 0. When looking through existing Arduino drum kit projects, [joekutz] noticed that most of them just used the microcontroller as an input for an existing MIDI device. So it is also possible to attach mount parts or to make it a kick pad. Code for home made electronic drum-kit, based on Arduino UNO. I use FSR to correspond to sound modules such as Roland and Yamaha. That would indeed reduce the CPU load by quite a bit. i am using Piezo sensors connected to the analog pins that will determine the note (which pad is hit) and the velocity of the hit. The signal sent from the pad of " 1 " is processed by arduino of " 2 " and converted into MIDI signal. Regarding the judgment of the head and the rim, it may be necessary to improve the code. Please see Step 10 for mounting on the pole and parts for it. Vector Data : https://github.com/RyoKosaka/drums/tree/master/vector. 2.Trigger midi converter with arduino UNO . How to build an e-drum kit with Arduino?Hello dear reader!-Why doing such a Project?First of all because if you like these kinds of things, you will enjoy the work process really … When looking through existing Arduino drum kit projects, [joekutz] noticed that most of them just used the microcontroller as an input for an existing MIDI device. There are a number of DAWs for PCs that can be used on this drum set, including GarageBand. When I googled that right, the due has 512KB of flash. This Post / Project can also be found using search terms: arduino midi drum code Requirements. In the past I have used these piezo sensors to rig up my desk and couch to play sounds when people interacted with them. If you short-circuit the pin as shown in the picture, it will be recognized as normal Arduino. When you looking at the thread title, you might think, “Nah, it’s another damn boring Arduino Based Drum kit around, there’s nothing special about this stuff!” First of all, don’t be so sure about it, as you haven’t read the whole story yet… Frankly, if you have the talent, it’s a piece of cake for you to build a sophisticated Arduino Based Drum set. Please fix as follows. It might be easier if you use glue gun. Nevertheless, setting is necessary depending on the size of the piezo, the size of the pad, the hardness of the sponge foam. If you connect normal arduino UNO directly to iPhone, you will get an error message like "Arduino UNO is not compatible". Are you sure you want to remove yourself as Please use MDF of 5.5 mm. Become a member to follow this project and never miss any updates, About Us I started making it to start drums. The highest value among them will peak. First, cut a 13 mm diameter stainless steel pipe. See PDF's for parts required, wiring diagram and code. Or you can use trigger to MIDI converter. created on 05/25/2020 Since the kick pad uses only one piezo, only tip can be used. It is difficult to edit STL data. It is the easiest way to complete your own e-drum. I hope this helps and CMIIW :), Question You can not open the hole neatly, but you can hide the hole so it's okay. Oct 4, 2016 - Homemade Electronic Drum Kit With Arduino Mega2560: This is my Arduino Project. First, measure the diameter of the pole where you want to install the part. We can handle the analog inputs with 10k linear potentiometers. Attach a 10 mm sponge to the FSR like a photo. The Microdrum project is based on Arduino UNO, which has 6 analog inputs and uses multiplexer circuits to increase up to 48 analog inputs. Korg Gadget has a drum machine in it. Took a while to understand what I was seeing, but now I will immediately go get some drumming lessons - or what other excuse do I have to build a drum set for?You did a good job here, love it! Use the M3-15 mm or M3-25 mm bolts for the center part to fix the bottom part to each other. It is designed to have the same dimensions as those made with a 3D printer. Sign Up. I am sorry that the reply was delayed. For silencing, put a 5 mm thick sponge and drill a hole. The possibilities are endless. Unlike other pads, the velocity of the pedal is constant. Cheers! Do not worry. You can check the code on GitHub or Arduino Create. If it is FSR, it may be possible to respond by just modifying the code. // Arduino analog input used to sense piezo drum hits then sent serialy to processing. For trigger cones the best choice is to buy already molded ones. If you lower it too hard the rim will sound when you hit the head. So please forgive my poor performance. and Let’s review the code.We first import the needed libraries.The spi bus is declared with the right GPIO We define the CS pin that is needed for the spi as well And then we create the MCP object. For More Details Go to the Link In the Description:-http://www.beginnertopro.in/post/318For More Projects Go to:www.beginnertopro.in With more than 14 years as the leading voice in the maker movement, we offer a wide range of topics in our magazines and book series such as 3D Printing, robotics, programming, microcontrollers and drones, crafting and much more for all skill levels. Do not forget to make the height of the shell 55 mm. FSR can be used even if a hole is opened. A value for judging that the beating is over. "); 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; }}, Answer