have worked more on the pwm problem it is stil not fixed. Have improved the math used