cs-midi-docs/docs/examples/04-banks/05-switch-selector.md

606 B

SwitchSelector

Two-state bank selection from a toggle switch.

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

using namespace cs;

BluetoothMIDI_Interface midi;

Bank<2> bank(1);

Bankable::CCValue<2> ccVal {
    {bank, BankType::ChangeAddress},
    {16, Channel_1},
};

SwitchSelector selector {
    bank,
    5,
};

int main() {
    stdio_init_all();
    if (cyw43_arch_init()) return 1;
    Control_Surface.begin();
    while (true) {
        Control_Surface.loop();
        uint8_t val = ccVal.getValue();
        (void)val;
        sleep_ms(1);
    }
}