tttapa / Control-Surface

Arduino library for creating MIDI controllers and other MIDI devices.
GNU General Public License v3.0
1.23k stars 137 forks source link

Condition for sending MIDI #429

Open Willame156 opened 3 years ago

Willame156 commented 3 years ago

First of all, thanks for this great library. I ask for your help in resolving 2 issues: 1st - "button_01" send CC 2, but if more than 1 second send CC 10; 2nd - Do not read "button_01" if button_02 has pressed

#include <Control_Surface.h>    
#include <MIDI_Interfaces/BluetoothMIDI_Interface.hpp> 

BluetoothMIDI_Interface midi;  

CCButtonLatched button_01 = {15 ,  { 2, CHANNEL_1}, };  // if more than 1 second send midi CC 10
CCButton button_02 = {23 ,  { 4, CHANNEL_1}, };  //Do not read "button_01" if button_02 has pressed

void setup() {
   Control_Surface.begin();
}

void loop() {
  Control_Surface.loop();
}

//I thank you for your attention

ACuppaJoes commented 3 years ago

I think this tutorial might help you out with your issue https://www.instructables.com/Arduino-Dual-Function-Button-Long-PressShort-Press/

Willame156 commented 2 years ago

Acho que este tutorial pode ajudá-lo com seu problema https://www.instructables.com/Arduino-Dual-Function-Button-Long-PressShort-Press/

Obrigado por sua resposta. Me perdoe a demora em comentar, acabei esquecendo.

tttapa commented 2 years ago

I think this tutorial might help you out with your issue https://www.instructables.com/Arduino-Dual-Function-Button-Long-PressShort-Press/

Alternatively, you could use https://tttapa.github.io/Control-Surface-doc/Doxygen/d7/d83/classAH_1_1IncrementButton.html, it already handles long and short presses for you.

Willame156 commented 2 years ago

Acho que este tutorial pode ajudá-lo com seu problema https://www.instructables.com/Arduino-Dual-Function-Button-Long-PressShort-Press/

Alternativamente, você pode usar https://tttapa.github.io/Control-Surface-doc/Doxygen/d7/d83/classAH_1_1IncrementButton.html , ele já lida com pressionamentos longos e curtos para você.

Obrigado tttapa, já consegui incluir o botão com duas funções usando a Control Surface

diegogauffin commented 3 months ago

Hey Willame, can you share your code?