Using PWM to generate analog values