Servo Position
Navic
Posts: 38
I'm using the standard servo with a BS2px and have a sweep function that rotates the horn from full left to full right and then full right to full left. I'm inserting breakpoints at random spots that will stop the servo from rotating and after than I want to horn to go back to the full left position, but I can't figure out how to do that.
Here's the turning code:
The pulse values I had experimented with to get, perhaps there's a better method. I tried to use the variable I to figure out where the horn was when stopped, but it doesn't work if the horn is past the 90 degree mark. Any help as to how to figure out horn position and movement would be much appreciated. Thanks!
Navic
Here's the turning code:
'Full left to full right FOR I = 1 TO 24 PULSOUT 14,250 PAUSE 20 'Full right to full left FOR I = 1 TO 22 PULSOUT 14,2750 PAUSE 20
The pulse values I had experimented with to get, perhaps there's a better method. I tried to use the variable I to figure out where the horn was when stopped, but it doesn't work if the horn is past the 90 degree mark. Any help as to how to figure out horn position and movement would be much appreciated. Thanks!
Navic
Comments
Your second loop, with the PULSOUT 14,2750 will cause the servo to immediately begin moving to the full left position regardless of what it was doing or what position it was at. You may or may not need more than 22 loops to allow the servo to move through its complete range. You'll have to figure that out. More loops just take more time, they don't result in more movement.