ADC Conversion on Timer/Counter Overflow

The ADC can be configured to do a conversion on any event. In this example, a timer/counter overflow event is used. This can be very useful when the timer/counter is used for PWM generation, as the ADC sampling can be synchronized to the PWM.