06-09-2010 10:15 AM
06-10-2010 02:09 PM
Hi Chrisx90-
I found an example on our community that actually creates a square wave that has a dynamically changing pulse width in accordance with a sine wave. It may be a useful reference for you, and can be found here.
In terms of incrementing your duty cycle with time, you can do this by implementing some logic using the iteration counter on your while loop. Below is a picture of an example of increasing a voltage over time using a for loop, but the same idea can be incorporated using a while loop.
In terms of it corresponding to an angle increase, I believe that is decided by your servo. The servo is set to respond to a specific pulse width. You will have to determine from the servo specs how the servo angle will respond depending on the pulse width you send it.
I hope this helps. Best of luck to you!