It is pretty natural to start playing with interrupts as we write program for the clock. There are 3 (in UNO, other boards have different number) internal timer based interrupts. Timer0 and Timer2 are based on 8 bits counters, so I decided to use Timer1 here with 16 bits. The prescaler set to 64 and match register to 2499 did the trick (one could use as well 256;624 or 8;19999 pairs for Timer1 looking for 100Hz refresh).
The next step after testing if it works at all was to display ful time, and especially seconds. So 4 digits offered by TM1637 based module (let’s call it part I) was not enough. I used 8 digits 7 segment display based on MAX7219.
For the code, apart from DS3231 library mentioned in previous post, I used also Eberhard Fahle LedControl library.
Basic setup to test HMC5883 on GY-273
Just connect: GND, VCC (5V), SCL and SDA (I2C standard signals) to your Arduino. Older versions could use A4 for SDA and A5 for SCL, but with most up-to-date boards appropriate dedicated pins (see green and purple connection lines) could be used,
And another image with shorter connectors: Continue reading HMC5883 GY-273 test