Adding a high-hat pedal?

Adding a high-hat pedal?

Postby jmerullo » Mon Mar 14, 2011 10:21 am

Hi There,

I bought the Drum Kit AI in order to build a practice set for my son. This is my first Arduino project. I soldered it together last night and everything seems to be working well. The next step is to build a set of pads and a PVC stand for it all.

I would like to add a pedal to control the high-hat sound. I would add a switch to one of the digital inputs, which would change the MIDI note number for one of the pads between the open and closed high-hat note.

I think I can figure out the hardware part of it but as I'm new to programming an Arduino, can anyone give me some pointers as to how to change around the sketch?

I'm sure it's just a matter of doing something like "If high-hat switch is pressed, change the high-hat note" but I'm having a bit of trouble following the logic of the program. The fact that the pad notes are stored in an array (?) seems to make it less straight-forward.

Sorry for my ignorance, but I haven't programmed much since my TRS-80 days!

Jim
jmerullo
 
Posts: 1
Joined: Mon Mar 14, 2011 10:13 am

Re: Adding a high-hat pedal?

Postby Spike » Sat Mar 19, 2011 10:39 am

You could try this;

Add the following to the declaration section of you sketch:
Code: Select all
boolean HiHatSwitchPin =3;          // Digital pin you are using for switch (don't use 0 or 1)
int  HiHat = 0;                     // Array element (the piezo connector you are using)
                                    // Numbered from from left to right on the Drum Kit
int  ClosedNote = 60;               // the MIDI note for the closed sound
int  OpenNote  = 61;                // the MIDI note for the closed sound


and add this to the main loop:
Code: Select all
digitalRead(HiHatSwitchPin);
  if(HiHatSwitchPin)
  {
    PadNote[HiHat] = ClosedNote;
  }else
  {
   PadNote[HiHat] = OpenNote;
  }


Hope this helps!
Spike
Site Admin
 
Posts: 95
Joined: Tue Feb 16, 2010 12:51 pm


Return to Drum Kit

Who is online

Users browsing this forum: No registered users and 0 guests

cron