arduino-volume2
arduino-volume2 copied to clipboard
Consider the Output Compare Modulator (OCM1C0A) on the Mega
On the ATMega2560 and ATMega32U, there's an Output Compare Modulator (OCM1C0A) that does this modulation in Hardware, however it is limited to just the Arduino Mega digital pin 13.
If you configure the timers for OCR1C and OCR0A PWM output, you get hardware modulation of the two timers on the shared PB7/OC1C/OC0A pin.