simple query: counting up rotations
in
Programming Questions
•
1 year ago
Hey guys.
Im controlling a pan servo motor which can turn 3.5 rotations, so 1080 degrees. I currently have a value sending from the direction of an arrow within a circle, ranging from 0 to 360 degrees. I want this instead to keep counting when it passes 360, all the way to 1080.
I thought i could achieve it with something like this -
if ( panAngle > 360 && panAngle < 720 ) {
panAngle = panAngle + 360;
}
but this doesn't work, as the panAngle just becomes 0 again when it gets past 360. Can anyone help?
thanks
Rich
1