Ok. I wasn't thinking about the load on the servo. What I think I'll do then is put the pulse that controls the "zero" position in the loop that is waiting for the button to be pressed (so that it is "zeroed" when button is NO), then have the movement pulse in the second loop.
Code:'Continuous loop until triggered by ignition button buttonloop: Pulsout PORTA.1, 150 'pulse to servo for a length of 1.5 ms to move to "zeroed" position If (BUTTON=0) Then goto buttonloop Pause 10 If (BUTTON=1) Then goto positionloop goto button loop 'Servo position control loop positionloop: FOR I=1 TO 100 Pulsout PORTA.1, 100 'pulse to servo for a length of 1 ms to rotate servo CCW certain number of degrees Pause 19 'pulse to servo every 10 ms for a total of 1 second NEXT goto buttonloop End 'end of program never reached
Thanks!




Bookmarks