good evening
It is my first message here and I hope to help within what my knowledge allows me
I am trying to program 5 encoders in an arduino uno, using a for loop to better manage and reduce the code
I have two other for loops programmed with 16 buttons each and they work perfect for me, but in this case, I am not able to make it work
Could someone guide me a bit?
a greeting
isn't valid. You are accessing index 5 of those arrays, and the indexes only go up to 4.
Perhaps you wanted to enable interrupts on all 10 pins? Uno only has 2 interrupt pins (2 & 3). EDIT: Ah, I see you are using a library that automatically uses pin change interrupts. So try this:
for (int i = 0 ; i <numberofencoders ; i++) {
pinMode(outputA[i], INPUT_PULLUP);
pinMode(outputB[i], INPUT_PULLUP);
enableInterrupt(outputA[i] , encoder , CHANGE);
enableInterrupt(outputB[i] , encoder , CHANGE);
}
thank you all for answering
I tell you, that same structure works with a single encoder, in the serial port I receive the perfect information and send the midi message that I want, the problem has been when using the for loop, I do not receive any information through the serial port, I was making some changes and only value 0 or 127 and it does not stop sending data when I only want it to send data when I am moving it, that's why I am so lost, surely it is a simple thing
as soon as I get home I try some things that you have told me and I will tell you
Thanks again for the help !!