You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey Pieter! How are you? Hope fine!
I was thinking it would be really usefulll to get a way to change between CCButton (momentary) and CC Latched in the run. Do you think is that posible ? I mean doing it without changing the code, upload and so on.
The text was updated successfully, but these errors were encountered:
I don't know how to get a new function without changing the code.
But here is an example of code with a button (connected to pin 2) which, when pressed briefly, transmits CC 20 Latched, and when pressed long, CC20 momentary
#include <Control_Surface.h>
USBMIDI_Interface midi;
unsigned char btn_flg = 0;
// Ignore the name “increment” button, it's simply a button
// class that can detect long and short presses.
IncrementButton btn { 2 }; // pin number of button
void setup() {
Control_Surface.begin();
btn.begin();
}
void loop() {
Control_Surface.loop();
switch (btn.update()) {
case IncrementButton::ReleasedShort: // If button is released after short press
Control_Surface.sendCC(20, btn_flg * 127);
btn_flg = !btn_flg;
break;
case IncrementButton::IncrementLong: // If button is still pressed after some time
Control_Surface.sendCC(20, 127);
delay(35);
Control_Surface.sendCC(20, 0);
break;
}
}
You can use pointer to MIDIOutputElement and delete/create instance of CCButton or CCButtonLatched.
If you need to use getAddress() or setAddressUnsafe() there is no common interface for this but Pieter came with a workaround that helped me a lot: #971 (comment)
Hey Pieter! How are you? Hope fine!
I was thinking it would be really usefulll to get a way to change between CCButton (momentary) and CC Latched in the run. Do you think is that posible ? I mean doing it without changing the code, upload and so on.
The text was updated successfully, but these errors were encountered: