MIDI device turns off when i use an expresion pedal

I made a midi footswitch with an arduino Pro Micro that worked fine, until I added a TRS input for an expresion pedal.
It doesn't work as intended, because when i turn the pedal to it's zero position the device disconnects. Also it kinda works erraticaly when it's not in zero position.

Don't know what is the problem.

Here it's the code

#include <Encoder.h>
#include <Control_Surface.h> // Include the Control Surface library
 
// Instantiate a MIDI over USB interface
USBMIDI_Interface midi;

CCButtonLatched buttons[] {
  { 2, 0x10,0 },
  { 3, 0x11,1 },
  { 4, 0x12,2 },
  { 5, 0x13,3 },
  { 6, 0x14,4 },
  { 7, 0x15,5 },
};

CCPotentiometer potentiometer = {
  A0, {MIDI_CC::Expression_Controller, CHANNEL_1}
};

void setup() {
  // put your setup code here, to run once:
  Control_Surface.begin();  // Initialize the Control Surface
}

void loop() {
  // put your main code here, to run repeatedly:
  Control_Surface.loop();  // Update the Control Surface
}

I'm using and arduino ProMicro, the 5v version. The TRS input is as it follows: The tip goes to 5v, ring to A0 and sleeve to GND.

Are you sure that is how the pedal is wired? Try swapping tip and ring.

Gonna try that

Finally works! Can't believe i made that mistake, te-hee. Thanks!
But why does it turn off the device when conected that way?

Without looking at the wiring diagram, it's hard to tell but most likely messed up your grounding.

Glad it's working. ALSO - are you using INPUT_PULLUP in your pinMode statement? Floating input pins can cause erratic behavior.

As i needed something very specific and found a way to do it very easily with the control surface library. Can't really tell what you refer to.

So I definitely fucked something up, because now the buttons don't work as intended. The expresion pedal works fine, but the buttons only work to turn off what i assign in the DAW.

FInally everything works, the buttons didn't work because of the code. This is the part that changed:

CCButtonLatched buttons[] {
  { 2, 0x10, },
  { 3, 0x11, },
  { 4, 0x12, },
  { 5, 0x13, },
  { 6, 0x14, },
  { 7, 0x15, },
};

The code that was uploaded before i added the expresion part was working, but the new one did not.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.