Hi aqibi2000,I believe the issue might be that you're calling analogWrite() three times in an infinite loop. This is continuously changing the PWM duty cycle many times faster than the duration of a single PWM output pulse.
Please try this library : https://github.com/AloyseTech/Zerodio/I'm unable to test your issue right now but maybe this could help.
Please enter a valid email to subscribe
We need to confirm your email address.
To complete the subscription, please click the link in the
email we just sent you.
Thank you for subscribing!
via Egeo 16