Click here to read the initial project proposal.
After testing with one drumstick and verifying that I could turn an LED on and off, I ordered additional ball tilt switches (the Arduino kit only comes with one). I purchased this lot of 10 from Amazon: Gikfun ball tilt switches. These new switches only have 2 posts instead of 4 like the one included with my kit.
When the new switches arrived, I constructed another drumstick and tested. I decided to wrap the sticks in white electrical tape so that they would be able to withstand more use.
Next I setup Processing 3 by uploading the Firmata protocol to my Arduino. This allows you to interface with the Arduino from Processing (you must have the Arduino Library for Processing folder added to your Processing libraries folder for this to work). Then I experimented with some code.
I set digital pins 2 and 3 on the Arduino to INPUT. I also wired my drumsticks/switches from +5V power to pins 2 and 3. When the ball tilt switches are level, they complete the circuit and send a HIGH signal to Processing. When the switches are not level, such as when striking a virtual drum, the circuit is broken and the Arduino sends a LOW signal to Processing.
Next, I found some drum sound effects (WAV files) online to use as drum beats. I imported the Minim sound library for Processing and was able to use the play() function to play my sounds whenever there was a LOW signal detected by the Arduino.
The reason I chose to play the sound effect on a low signal was to prevent the sounds from going off while the drumsticks were being held in the vertical position. Each time the user swings the drumsticks, it breaks the circuit, sends a LOW signal to Processing, and my program plays the sound.
This was a fun experiment and obviously there are likely other types of switches that would be more accurate to use as virtual drumsticks, but for the price and simplicity, I was happy with the results I achieved.