I found a dirt cheap Trace Elliott foot controller on ebay and when I opened it up, the PCB had switches and leds already in place, so I just soldered some wires to connect it to the arduino. Adapting an existing arduino code, I soon had it transmitting the relevant midi messages to control the M13 looping functions. I kept it to the basic rec / overdub / stop / start since I rarely use reverse & back during our covers set, but they can easily be added with a longer pedal – I’ve now ordered some plastic trunking to see if that can make a viable 6 way alternative.

The code has been evolving, not without some head-scratching & forum-searching. <smug>The overdub button now blinks (to match the m13 light setup) and the play led stays on during overdub. </smug>

See my other post with the relevant midi messages.

The code, for geeks, is below

// midi controller for line 6 M13 to control looper
// dec 2018

#include <MIDI.h>
#include <midi_Defs.h>
#include <midi_Message.h>
#include <midi_Namespace.h>
#include <midi_Settings.h>

MIDI_CREATE_DEFAULT_INSTANCE();
// Constants
#define recSWITCH 2 //rec
#define ovrSWITCH 3 // stop/OD
#define playSWITCH 4 // play
#define stopSWITCH 5 // stop
# define recLED 8
# define ovrLED 9
# define playLED 7
# define stopLED 6

#define SWITCHES 4 // how many switches?
#define BOUNCEDELAY 100
int switches[SWITCHES] = { recSWITCH, ovrSWITCH, playSWITCH, stopSWITCH };
int switchState[SWITCHES] = { HIGH, HIGH, HIGH, HIGH }; // Initial state of switch is high due to internal pullup
int leds[SWITCHES] = { recLED, ovrLED, playLED, stopLED };
int currentSwitch = 0;
int thisLed = 0;
int activeLed = 0;
int ovrLEDstatus = 0;
int led = 9; // the PWM pin the LED is attached to
int brightness = 55; // how bright the LED is
int fadeAmount = 7; // how many points to fade the LED by

void setup()
{
pinMode(recLED, OUTPUT);
pinMode(ovrLED, OUTPUT);
pinMode(playLED, OUTPUT);
pinMode(stopLED, OUTPUT);
MIDI.begin(1);
// Setup Switches and activation LEDs
for ( currentSwitch = 0; currentSwitch < SWITCHES; currentSwitch++ )
{
pinMode( switches[currentSwitch], INPUT ); // Set pin for switch
digitalWrite( switches[currentSwitch], HIGH ); // Turn on internal pullup
pinMode( leds[currentSwitch], OUTPUT ); // Set pin for LED
}
intro(); // flash light on bootup
}

void loop()
{
ovrblink(); // blink ovr led if ovr is set+
for ( currentSwitch = 0; currentSwitch < SWITCHES; currentSwitch++ ) // loop waiting for foot switch presses
{
if ( (digitalRead(switches[currentSwitch]) != switchState[currentSwitch] ) && (switchState[currentSwitch] == HIGH) )
{
switch ( currentSwitch )
{
case 0:
MIDI.sendControlChange(50, 122, 1); // rec
lightPin(currentSwitch);
break;
case 1:
MIDI.sendControlChange(50, 10, 1); // overdub
if (ovrLEDstatus == 0 ) { // set blink, don’t use lightpin
digitalWrite( recLED, LOW ); // off
digitalWrite( stopLED, LOW ); // off
digitalWrite( playLED, HIGH ); // off
ovrLEDstatus = 1; // signal to start blinking
}
else {
digitalWrite(ovrLED, LOW); // switch overdub LED off
ovrLEDstatus = 0; // switch overled blink off
}
break;
case 2:
MIDI.sendControlChange(28, 122, 1); // play
lightPin(currentSwitch );
ovrLEDstatus = 0; // signal to stop blinking
break;
case 3:
MIDI.sendControlChange(28, 22, 1); // stop
lightPin(currentSwitch );
ovrLEDstatus = 0; // signal to stop OVR blinking if it is
break;
}
delay( BOUNCEDELAY );
}
switchState[currentSwitch] = digitalRead( switches[currentSwitch] );
}
}

void lightPin( int activeLed ) // switch chosen LED on, others off
{
for ( thisLed = 0; thisLed < SWITCHES; thisLed++ )
{
if (activeLed == thisLed)
{
digitalWrite( leds[thisLed], HIGH );
}
else
{
digitalWrite( leds[thisLed], LOW );
}
}
}

void intro() // startup flashes
{
for ( int i = 0; i < 4; i++ )
{
for ( thisLed = 0; thisLed < SWITCHES; thisLed++ )
{
digitalWrite( leds[thisLed], HIGH );
delay(100);
digitalWrite( leds[thisLed], LOW );
}
}
}

void ovrblink()
{
if (ovrLEDstatus) // blink once if set
{
analogWrite(led, brightness);
brightness = brightness + fadeAmount;
if (brightness <= 0 || brightness >= 255) { // reverse the direction of the fading at the ends of the fade:
fadeAmount = -fadeAmount;
}
delay(3);
}
}