Switching functions by double pressing

Maikele

New member
Hello there,
I'm working on a MIDI trim/fader project for my Sound devices 833 mixer, I'm using 2 rotary encoders to control channels 7 and 8 using the Control_Surface library

Now the the issue is that I want to be able to double press the encoder switches (pins 6 and 7) to toggle between {MCU::V_POT_#, CHANNEL_#}, (Which controls Fade) and {MCU::V_POT_7}, (Which controls trim)

I'm quite new to Teensy/Arduino and coding so i've got no clue how to make this possible. Anyone got any ideas

Code:
#include <Encoder.h> // Include the Encoder library.
#include <Control_Surface.h> // Include the Control Surface library

// Instantiate a MIDI over USB interface.
USBMIDI_Interface midi;

NoteButton buttons[] {
  { 6, MCU::V_POT_SELECT_7 },
  { 7, MCU::V_POT_SELECT_8 },
};

CCRotaryEncoder enc1 {
  {2, 3},                // pins
  {MCU::V_POT_7, CHANNEL_7}, // MIDI address (CC number + optional channel)
  1                      // optional multiplier if the control isn't fast enough
};

CCRotaryEncoder enc2 {
  {4, 5},                // pins
  {MCU::V_POT_8, CHANNEL_8}, // MIDI address (CC number + optional channel)
  1                      // optional multiplier if the control isn't fast enough
};


void setup() {
  // Select the correct relative MIDI CC mode:
  RelativeCCSender::setMode(relativeCCmode::MACKIE_CONTROL_RELATIVE);
  Control_Surface.begin(); // Initialize Control Surface
}

void loop() {
  Control_Surface.loop(); // Update the Control Surface
}
 
I don't have any suggestions to offer for your original question, but I do have an alternate approach to suggest: Could you use a combination of "button pressed + the encoder rotated" to change between your modes ?? If the encoder is rotated (without the button being pressed), then the value of the current selection is modified. If the button is pressed (while the encoder is not changing), then the current selection is activated/selected. If the encoder is rotated (while the button is pressed), then the current mode is changed. Does this make sense ?? Would this be any easier to implement ??

Mark J Culross
KD5RXT
 
Back
Top