Use ATmega328P timer/counter to create different timer interrupts, normal mode and CTC mode (example for Arduino Uno).
Target system: Arduino Uno
Development environment: Visual Studio Code with PlatformIO.
Documentation: https://www.schaerens.ch/iot-arduino-timer