cs-midi-docs/docs/examples/02-input/06-kp-value.md

488 B

KPValue

Reads incoming Key Pressure (aftertouch) values.

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

using namespace cs;

BluetoothMIDI_Interface midi;

KPValue kpVal {{MIDI_Notes::C[4], Channel_1}};

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