Problem with Servo Motors and RobotC

Unofficial answers are usually faster than official answers, so I’m reposting your topic here: I’m bad at creating links, so I won’t link to your original post in the official answers forum, but interested parties should look there for “Problem with Servo Motors”

RobotC specific questions can also be asked at robotc.net forums.

  • It seems unlikely that plugging in a servo could corrupt the program.
    Human brains are hardwired to make generalizations and find to associate cause and effect due to proximity of unrelated events: “My sneezes affect the weather”. If your CPU won’t accept new firmware, that seems like a completely different issue than Servo.
  • You didn’t specifically say that the CPU accepts new firmware when the Servo is unplugged, but does not when Servo is plugged in. If that is the case, it is possible that the Servo is shorted, and it shorts out the whole CPU power or something similar.

General debugging suggestions for similar topics:

  • make a simpler program to just debug this one feature (controlling a servo), just copy the joystick value to the motor port of the servo and see if you can move it back and forth to match the joystick.
  • swap the servo with a motor, and see if the motor moves correctly for a motor.
  • check the servo by plugging it in a motor port and see if it moves
  • check the servo and programming in EasyC instead of RobotC
  • check the servo with default code instead of your code

Notes on your specific program code:
You have a large number of choices and each calls to the “move” routine.
It is not clear that your choices are all mutually exclusive. You may want to do a “next” after each call to move, so that your code will restart at the top of the loop, or make them all mutually exclusive, or have each choice set some variables, and then call move once at the bottom of the loop.
One symptom of this type of problem is for the robot to be twitchy or jittery, but this can also be a symptom of low battery power, or motor overload.

I would also try to use the RobotC debugger to check if your servos and sensors are appearing. You can also do those tests in the debugger by typing in the values you want your servo to output (make sure the program isn’t writing out to it or it will overwrite your commands - the simplest way to do this is just plugging it into another motor port and using that instead, you don’t actually need the pragmas to output to the motors)

Did you also try to load both the master code and the firmware because that might make a difference. Also when I had trouble loading the firmwares I used the IFI loader instead of the RobotC loader…