Switch.h

I am right at the end of making an Arduino based Midi foot controller
I found online called MIDI Mule, but have gotten stuck on uploading the code.
I have a error message saying “ Switch.h: No such file or directory”.
Have added the two extra directories required

1 Arduino MIDI library
(https://github.com/FortySevenEffects/arduino_midi_library)
2 Switch Debouncing library
(https://www.avdweb.nl/arduino/hardware-interfacing/simple-switch-debouncer)

The Switch directory is called by a different name “<avdweb_Switch.h>”

Have I got the wrong version?

Any help would be much appreciated.
Thanks Hutzpah

Project MIDI Mule
https://thoro.de/en/guitars/midi_mule/

#include “Arduino.h”
#include “Switch.h”
#include “MIDI.h”

// Define analog pins for LEDs
int ledPin1 = A0;
int ledPin2 = A1;
int ledPin3 = A2;
int ledPin4 = A3;
int ledPin5 = A4;
int ledPin6 = A5;
int ledPin7 = 10; // Workaround, A6 just works as digital input
int ledPin8 = 11; // Workaround, A7 just works as digital input

// Switches
Switch buttonGND1 = Switch(2); // button to GND, use internal 20K pullup resistor
Switch buttonGND2 = Switch(3); // button to GND, use internal 20K pullup resistor
Switch buttonGND3 = Switch(4); // button to GND, use internal 20K pullup resistor
Switch buttonGND4 = Switch(5); // button to GND, use internal 20K pullup resistor
Switch buttonGND5 = Switch(6); // button to GND, use internal 20K pullup resistor
Switch buttonGND6 = Switch(7); // button to GND, use internal 20K pullup resistor
Switch buttonGND7 = Switch(8); // button to GND, use internal 20K pullup resistor
Switch buttonGND8 = Switch(9); // button to GND, use internal 20K pullup resistor

// MIDI init
MIDI_CREATE_DEFAULT_INSTANCE();

void setup() {
// Set serial baud rate: 31200 for MIDI / 9600 for debugging
// Serial.begin(31200);
MIDI.begin(1); // Launch MIDI and listen to channel 1
}

void loop() {
buttonGND1.poll();
if(buttonGND1.released()) {
// Serial.write(“Button 1\n”);
MIDI.sendProgramChange(0,1); // Send the MIDI command
ledOffAll();
analogWrite(ledPin1, 255);
}
buttonGND2.poll();
if(buttonGND2.released()) {
// Serial.write(“Button 2\n”);
MIDI.sendProgramChange(1,1); // Send the MIDI command
ledOffAll();
analogWrite(ledPin2, 255);
}
buttonGND3.poll();
if(buttonGND3.released()) {
// Serial.write(“Button 3\n”);
MIDI.sendProgramChange(2,1); // Send the MIDI command
ledOffAll();
analogWrite(ledPin3, 255);
}
buttonGND4.poll();
if(buttonGND4.released()) {
// Serial.write(“Button 4\n”);
MIDI.sendProgramChange(3,1); // Send the MIDI command
ledOffAll();
analogWrite(ledPin4, 255);

}
buttonGND5.poll();
if(buttonGND5.released()) {
// Serial.write(“Button 5\n”);
MIDI.sendProgramChange(4,1); // Send the MIDI command
ledOffAll();
analogWrite(ledPin5, 255);

}
buttonGND6.poll();
if(buttonGND6.released()) {
// Serial.write(“Button 6\n”);
MIDI.sendProgramChange(5,1); // Send the MIDI command
ledOffAll();
analogWrite(ledPin6, 255);

}
buttonGND7.poll();
if(buttonGND7.released()) {
// Serial.write(“Button 7\n”);
MIDI.sendProgramChange(6,1); // Send the MIDI command
ledOffAll();
analogWrite(ledPin7, 255);

}
buttonGND8.poll();
if(buttonGND8.released()) {
// Serial.write(“Button 8\n”);
MIDI.sendProgramChange(7,1); // Send the MIDI command
ledOffAll();
analogWrite(ledPin8, 255);

}
}

void ledOffAll() {
analogWrite(ledPin1, 0);
analogWrite(ledPin2, 0);
analogWrite(ledPin3, 0);
analogWrite(ledPin4, 0);
analogWrite(ledPin5, 0);
analogWrite(ledPin6, 0);
analogWrite(ledPin7, 0);
analogWrite(ledPin8, 0);
}

Hutzpah:
The Switch directory is called by a different name “<avdweb_Switch.h>”

Have I got the wrong version?

The file was renamed from Switch.h to avdweb_Switch.h some time ago. Apparently the author of the tutorial was using a version of the library before that name change. I just compiled it with the latest release of the avdweb_Switch library and it does compile, so I would just change the line:

#include "Switch.h"

to:

#include "avdweb_Switch.h"

pert thanks very much for your help.

You're welcome. I'm glad if I was able to be of assistance. Enjoy!
Per