So should my modified files still be named Encoder.h and Encoder.cpp, or can I can I rename them to differentiate them from the originals?

Also, thanks for pointing out the BelaEncoder.* files. I didn't think to look at those.

    stgislander So should my modified files still be named Encoder.h and Encoder.cpp, or can I can I rename them to differentiate them from the originals?

    as you prefer. As long as you don't

    #include <libraries/Encoder/SOMETHING

    then none of the files in libraries/Encoder will be used.

    I prefixed the modified Encoder and BelaEncoder files with "New" to keep me straight. I changed all #include statements to "NewEncoder.h" and "NewBelaEncoder.h". Finally I uploaded two new .cpp and two new .h files into my project folder, and rebuilt them

    The project built successfully, so it appears I can now get back to troubleshooting.

    Success. I need to exercise it more to find any hidden bugs, but it counts at every step. Next is to edit render.cpp to read 2-3 encoders.

    Thanks Giulio.

    Good news! If you have any code worth sharing that could be integrated back in the original library, let us know here or by making a pull request on github.com/BelaPlatform/Bela/pulls

    If you were going to read three different encoders, would you just create three instances of gEncoder?

    For example in render.cpp, something like Encoder gEncoder[3];

    an array like that would be a good option. You could make it std::vector<Encoder> gEncoder(3); or std::array<Encoder, 3> gEncoder; so that you can later call gEncoder.size() to get the number of elements.

    Thanks Giulio. I'm not familiar with the syntax you use so it takes me a bit to figure out what you are doing. It's nothing like the software for the control system that I maintain, which is over 10 years old.

    Looking at other code, I am guessing that to use std::vector I have to add #include <vector.h>. Likewise, to use std::array I have to add #include <array.h>. Correct? Otherwise I get a "use of undeclared identifier 'std'..." error.

    Using #include <vector.h> though, I get a "'vector.h' file not found..." error.

    confusingly, C++'s standard library includes do not include .h, so:

    #include <vector>

    or

    #include <array>

    I used std::array<Encoder, 3> gEncoder; and created arrays to hold the DIO pin numbers for each encoder. Everything looks good so far.

    My only issue now that I now need to dig into (and that I didn't notice before) is that when I press the encoder button to perform the counter reset, the console fills up with "reset : 0" messages.

    Found the problem. I forgot to create an array to hold three boolean gButtons.