Generating PWM in sleep mode

Hello.

I wanted to generate PWM during a sleep mode. I have read on a one website, that it is possible while using timer2 in asynchronous mode.

I'm not quite sure what do I have to do. I would be glad if you could write step-by-step what I need to do or if you pasted the code with comments so I understood it.

Thank you for your help :)

Paweł

Read the datasheet,

10.6 Power-save Mode

If Timer/Counter2 is enabled, it will keep running during sleep.

and

10.9 Power Reduction Register

10.11.3 PRR – Power Reduction Register

You can find libraries to help with setting the right mode, or more than likely just write the registers directly.