cs-midi-docs/docs/examples/01-output/15-cc-rotary-encoder.md

693 B

CCRotaryEncoder

Relative CC encoder for DAW parameter control.

Original: RotaryEncoder.ino

#include "pico/stdlib.h"
#include "pico/cyw43_arch.h"
#include <cs_midi.h>

using namespace cs;

BluetoothMIDI_Interface midi;

CCRotaryEncoder enc {
    {0, 2},       // encoder pins A and B (constructs AHEncoder)
    {16, Channel_1}, // CC address
    1,            // speed multiplier
    4,            // pulses per step
};

int main() {
    stdio_init_all();
    RelativeCCSender::setMode(relativeCCmode::MACKIE_CONTROL_RELATIVE);
    if (cyw43_arch_init()) return 1;
    Control_Surface.begin();
    while (true) {
        Control_Surface.loop();
        sleep_ms(1);
    }
}