Microcontroller as time switch