Control_Surface.h Library display CC Values in Oled

Hello, I'm using Control Surface Library to build a controller with rotary encoders, buttons, and an Oled display. This will control some mixing plugins.
I would like to print the cc values from 0-127 in my oled every time I move any of my rotary encoder, and also everytime i move a pot from my DAW if possible, but I can't figure out what should i do to program it. I found there's a function into the library called "getValue", but how should i put it in my code? Sorry, I'm new to coding. If anyone could give me an example... any help will be appreciated. Thanks.

This is my actual code:

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

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

const int speedMultiplier = 4;

// Instantiate a CCButton object
CCButton buttons [] {
  // Push button on pin 5:
  {5, {MIDI_CC::General_Purpose_Controller_1, CHANNEL_1}},
  {4, {MIDI_CC::General_Purpose_Controller_2, CHANNEL_1}},
};

CCRotaryEncoder encoders [] {
  {{3, 2}, MIDI_CC::General_Purpose_Controller_3, speedMultiplier, 4},
  {{9, 10}, MIDI_CC::General_Purpose_Controller_4, speedMultiplier, 4},
  {{15, 14}, MIDI_CC::General_Purpose_Controller_5, speedMultiplier, 4},
};


void setup() {
  Control_Surface.begin(); // Initialize Control Surface
}

void loop() {
  Control_Surface.loop(); // Update the Control Surface

 }

Please follow the advice given in the link below when posting code. Use code tags (the </> icon above the compose window) to make it easier to read and copy for examination

Sorry, I edited my original post. Thank you for your advice.

The CCRotaryEncoder class doesn't send the absolute position of the encoder, it just sends +1 or -1 to the DAW when you turn it, and the DAW is responsible for keeping track of the absolute position.

and also everytime i move a pot from my DAW if possible

This is relatively easy using the CCValue class, but this only works if the DAW you're working with actually sends the position back to the controller.

You can use a MIDI monitor to inspect what messgaes your DAW is sending, or you can use the USBDebugMIDI_Output class as demonstrated in the second example here: Control Surface: MIDI Tutorial

Thank you for your answer, Pieter.

That means it's not possible to print the values of my encoder? or is there another way?

Yes, I use Cubase, and have enabled the option to transmit the midi data form DAW. I will try to monitor the output as you explain. Thanks for your time!

You can print the position relative to the position of the encoder when the Arduino booted, but the Arduino has no idea of the absolute position, only the DAW does.

I understand now, thank you Pieter

@PieterP I have a related question maybe! I'm trying to use the Control_Surface.h library with Max MSP and I would like the MIDI value coming out of Max to control the brightness of an LED. Does this code look like it would work?

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

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

const pin_t ledPin = LED_BUILTIN; // Change this to your PWM pin <------

// Instantiate the LED that will light up when middle C is playing
NoteLEDPWM led {
  ledPin,                      // Pin of the LED, must be PWM pin
  {MIDI_CC::General_Purpose_Controller_1, CHANNEL_1}, // Note C4 on MIDI channel 1
};

void setup() {
  Control_Surface.begin(); // Initialize Control Surface
}

void loop() {
  Control_Surface.loop(); // Update the Control Surface
}

Any feedback would be much appreciated!

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