I noticed something odd when I tried to loop a claw so it would just open and close (eventually I want to have it just open when the ultrasonic sensor detects something in front of it and close a second or so later). Anyhow, when I tried a loop using the setServo command it loops, but the claw opens less and less each time -- the first time it opens fully, then after three iterations a little less, and so on until it hardly opens at all. I added a motor command line and that seemed to solve it, but it seems a kludgy workaround and I wondered if it was a misuse of the setServo command on a VEX 393 motor, which is what VEX is using on the claw assemblies. In any case, this is the code I used

#pragma config(Motor,  port1,           claw2,         tmotorVex393_HBridge, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

task main()
setServo(port1, -127);
setServo(port1, 127);

Anyhow if there's anything weird about this code and someone could let me know... I suspect the issue is something simple that I am not seeing and thanks in advance.

  • $\begingroup$ i don't know anything about the VEX programming language, but setServo() looks out of place ... also, is wait(1) long enough for the servo to arrive at its destination? $\endgroup$
    – jsotola
    Nov 13 '19 at 5:46
  • $\begingroup$ I hadn't thought of the wait being long enough -- I will see what happens when I try extending it. SetServo() just sets the servo to the zero position. $\endgroup$
    – Jesse
    Nov 13 '19 at 10:11
  • $\begingroup$ @jsotola - I tried changing the wait time; it didn't seem to have an effect $\endgroup$
    – Jesse
    Nov 14 '19 at 2:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.