Auto pHat Qwiic Dual Encoder Reader Firmware/Code Clarification

Hi there,

I’ve just been looking at the Github repo (https://github.com/sparkfun/Qwiic_Dual_Encoder_Reader) for the Qwiic Dual Encoder Reader to get a better understanding what’s going on “under the hood”. First of all, let me just take a sec to thank the author Pete Lewis, and anyone else involved, for your excellent work here!

I can see that there are two sketches in the firmware folder of the repo - Qwiic_Dual_Encoder_Reader.ino and interrupts.ino. My current understanding from reading each sketch is that interrupts.ino handles the actual encoder logic - i.e. increments counters based on the signals coming from the encoders. Qwiic_Dual_Encoder_Reader.ino on the other hand appears to handle all the I2C communication stuff, including the encoder interrupts. Is that, broadly speaking correct?

If so, what I don’t understand is how these two are linked. Surely the ATtiny84 can’t be running both sketches simultaneously? And, as far as I can tell neither script imports the other. I know the answer to this is probably obvious, but if someone could enlighten me as to what’s going on that would be great!

Thanks,

Greg

As far as I can tell from the source, the interrupt.ino is just another file in the sketch, holding the setupInterrupts() function which is called in the setup() of the “main” sketch (the one with setup() and loop()). You can have various .ino files in a single sketch as far as I know.

Right you are. Thanks very much for the help! Sorry, I’m quite new to programming micro-controllers.