tttapa / MIDI_controller

This is a library for creating a MIDI controller using an Arduino or Teensy board.
GNU General Public License v3.0
404 stars 69 forks source link

Use Momentary as Toggle #104

Open fristaildg opened 4 years ago

fristaildg commented 4 years ago

Hi! I'm super new at this and I'm sure this is a very simple task to achieve. I need to send CC messages to control Bias FX pedals and have done this so far: `#include

HairlessMIDI_Interface midi;

CCButton buttons[] = { {2, {MIDI_CC::Foot_Controller, CHANNEL_1}} };

void setup() { // put your setup code here, to run once: Control_Surface.begin(); }

void loop() { // put your main code here, to run repeatedly: Control_Surface.loop(); }`

But every time I press the button it sends on (127) when I press and off (0) when I release the button. How can I change my code to make the button behave as a toggler?

Huge thanks in advance!!

tttapa commented 4 years ago

You can use CCButtonLatched.
Have a look at the MIDI Output Elements module for a complete overview.

luisFernandezDevSpark commented 4 years ago

Yes I found it right after I asked you the question and it worked flawlessly. Huge thanks for this library, it has made the life of a complete noob like me super easy!