Hello everyone. I'm wondering if is it possible to do this:
I'm using the control surface library, and I would like to use a counter and put a variable inside the class "Button", so I could press a button and change the value of this variable.
If I use the serial monitor I see that the variable "CC1" actually changes, but when I check this in a midi software, nothing happens, is always sending the first value 0
Thanks!
#include <Control_Surface.h>
HairlessMIDI_Interface midi;
const int buttonPin = 0;
int buttonState = 0;
int prestate = 0;
int CC1 = 0;
int counter(){
buttonState = digitalRead(buttonPin);
if (buttonState == HIGH && prestate == 0) {
CC1++;
prestate = 1;
} else if(buttonState == LOW) {
prestate = 0;
}
}
CCButtonLatched ComandosCC[] = {
{2, {CC1, CHANNEL_1}},
};
void setup() {
pinMode(buttonPin, INPUT);
Control_Surface.begin();
}
void loop() {
counter();
Control_Surface.loop();
}