Replies: 3 comments 4 replies
-
looks that i did not copied the loop section `void loop() { // // Test button state |
Beta Was this translation helpful? Give feedback.
-
You don't need an external library, e.g.: #include <Control_Surface.h>
#include <AH/Hardware/MultiPurposeButton.hpp>
BluetoothMIDI_Interface midi;
// Create a Button object that reads a push button connected to pin 0:
MultiPurposeButton btn{0};
void setup() {
Control_Surface.begin();
btn.setLongPressDelay(1000);
btn.setMultiPressDelay(400);
btn.begin();
}
void loop() {
switch (btn.update()) {
case btn.None: break;
case btn.PressStart: break;
case btn.ShortPressRelease:
Control_Surface.sendControlChange({MIDI_CC::General_Purpose_Controller_1, CHANNEL_1}, 0);
break;
case btn.LongPress: /* ... */ break;
case btn.LongPressRelease: /* ... */ break;
case btn.MultiPress: break;
case btn.MultiPressDone: break;
}
Control_Surface.loop();
} |
Beta Was this translation helpful? Give feedback.
-
Checking both classes, is obvious that they have different properties and on the case of MultiPurposeButton, different events. And if the goal is to use MIDI addresses instead of the MultiPurposeButton, should i create a new class based on the MIDI address, with some of the propoerties, or is it possible somehow to combine both in order to make the "case" work? And also, how should i use [AH/Timing/MillisMicrosTimer.hpp] to set a delay to the "first single press" in order to avoid the first MIDI (0 to 127) printing and allow to do the second press with out interruptions? this value "btn.setMultiPressDelay(400); " is for the time between pressing as far as i can tell... and the delay should be higher that (400) Thanks |
Beta Was this translation helpful? Give feedback.
-
Hello!
I wonder if some one can give me a hint about that to modify on my code.
I was able to set up my 2 buttons controller via BLE and now i want to go beyond.
I want to make those 2 simple buttons to have more functions, by adding "2 quick press behavior" and "press and hold"
I found a library that has part of the code, so i am starting from small steps. I added the library and mixed with my first working BLE code but now i have lost the function of sinle press (i am staring with one button for now)
My current code looks like this:
`#include <Control_Surface.h>
#include <arduino.h>
#include <FWB.h>
BluetoothMIDI_Interface midi;
#define BP 0 //the pin where your button is connected
FWB bp;
void setup()
{
}`
My tests so far was to try with the orifinal class "CCButton button" and also changed the button class for bp and with BP but it does not compile.
Hope you can help!
Beta Was this translation helpful? Give feedback.
All reactions