Code for PWM sine wave generator + some questions.

I'm not sure. Analogwrite overflows predictably and just "wraps around". Second, the program is coded this way because neither wav1[2] nor wav2[2] will exceed 255 or fall below zero. Templitude always assumes a value between 1 and 0.