I am trying use my Arduino to control a guitar pedal, a DigiTech Whammy via MIDI, the pedal has a single MIDI In that can be used to control every funtion of the pedal. On the pedal there is a mode select dial, this sweeps through 17 different modes of pitch shift. So far I have found a sketch that has given me the ability to sweep through each mode continuously. Or I can create sequences for the mode change to follow.

Want I want, is a circuit and sketch that will allow me to choose when it advances to the next mode with a momentary footswitch. I have searched a lot to try and find a sketch that will allow me to use a single footswitch to control the Whammy in this way without success, I have attached a second code at the bottom which gave me A result, but not the correct result. Instead of advancing through each mode, it only jumps back and forth between two modes.

If anyone can help that would be amazing, I am still new to Arduino so I apologise if the problem is quite simple to fix.

The guitar pedal's manual says the the presets (mode) can be selected using MIDI Program Change commands. The Program Changes recognised by the pedal are #1 -> #34. Although, I'm only interested in modes #1 -> #17 as 18# ->#34 are with the effect turned off.

How do I tell it to use the button to cycle through each mode one by one with each press?

I have managed to get my circuit working. I found a different sketch to use as a starting point and also got some help from someone on IRC.

I have attached the sketch I am using, should anyone else ever want to do something similar. I'm sure someone will find a better way to write it but it does exactly what I want it to do. I also cleaned up the sketch and removed references to an LED, it was never my intention to add an LED as there are already LEDs on the guitar pedal itself which I can use to see which preset I am using.

When I press on the momentary switch the pedal advances to the next preset. If I press + hold the switch down, the pedal cycles continuously until I let go of the switch. This will be useful if I want to switch from preset 1 to preset 13 without having to press the switch 12 times.

Cyclegadget, thanks for your help. I tried your sketch, but it only switches from one preset to the other momentarily. I don't know if my explanation in previous posts was clear enough, hopefully this post has cleared that up.

// DigiTech Whammy IV - MIDI Controller. // MichaelJGuitar 2013 // Switch allows changing of Whammy preset. // Configured to cycle through all modes in active mode, an option for bypassing the effect is not required as there is already a switch on the unit for that.

if (keyispressed == LOW){ currentprogram++; delay (175); // When footswitch is pressed, the preset will change and then wait the amount specified before moving on to the next preset. if(currentprogram > 16) currentprogram = 0; // The Whammy has 16 presets, 0 - 16 are all active. setProgram(currentprogram); } else{