@Koepel: wow! what a detailed, thoughtful and helpful response. I am impressed & grateful that you took the time to find the source, read it, and comment (responses below). Will have to reply in 2 chunks because the forum just rejected my reply as overlength. Will have to wait 5 minutes between part 1 and part 2. So stay tuned...
The name 'current' for the sketch is confusing, 'current' is also an electrical current in ampere.
What about 'stable', 'development', 'latest', or something like that ?
Point taken. I don't see any reason to keep the name; now that I'm using git it doesn't really need to be named "current" any more (previously was using the cheap and dirty method of renaming the source file each time I reached a devel milestone).
Do you have a schematic ? I mean a real schematic made with Eagle or KiCad.
Alas no. I did try to make one with Fritzing but quickly gave up as I found the UI so cumbersome. I did not even know that KiCAD existed prior to reading your post here, but I have DL'd it and will try it out. I would like eventually to make a proper custom board for this project so a real schematic would be worth putting some time into.
Do you power the AS5601 with 5V ?
Do you power the 7-segement display with 5V ?
Is there anything on the I2C bus that runs at 3.3V ? For example almost all sensors run at 3.3V.
Yes, yes, and no. The AS5601 is packaged on a handy "evaluation board" (alas no longer available) which may or may not include a level converter; the board specs call for +5. My linear Hall sensor is also packaged on a breakout board that takes +5.
All the stuff that Leo1 talks to is powered off Leo1's +5. All the stuff that Leo2 talks to is powered off Leo2's +5. Ground is shared. See next item for more thoughts on this...
Your test for I2C power with a digitalRead of SDA and SCL. That is okay, nothing wrong with that.
That means that the SDA or SCL level are still too low.
Check the 5V wiring.
It occurred to me in the wee hours, sleepless and going over my build looking for possible explanations, that maybe the I2C bus as I've wired it is a bit sketchy (so to speak). The 2 Leonardos are powered (separately) by their USB connections. I was told at some point months ago that their +5vdc should not be connected; ground should be common, but the +5 bus for each should be separate.
However, they both participate in the I2C bus, which is pulled high by their internal +5v when idle. Is that equivalent to connecting their +5vdc as I was told not to? I had not thought of this before. I don't know how, or if, the digital output pins on the Leo are isolated from vcc.
You already have some delay in setup() before checking SDA and SCL. I think that delay should be enough.
Good. I was aware (from bitter experience) that the Wire init takes a while. The init timing is actually rather carefully arranged, so that Leo1 doesn't look for Leo2 until the last possible moment (giving Leo2 time to init its own Wire protocol).
[end Part 1]