pwm final

works, maybe a bit ugly