
Re: Semi-Novice Programmer - I need help!
try this for two opposing servos moving the same thing.
lets say we have two servos SERVO_A and SERVO_B. We are going to set the value of SERVO A manually and set the value of SERVO_B automatically.
this works because in the background RobotC ramps the servo positions up and down smoothly (which is a good thing or you'd have to do it yourself)
ServoValue[...] gives the current actual position of the servo (or more accurately the position RobotC firmware is actually commanding it to go to)
Since the servos are in backwards we use the 255-x to approximate the best position for the tracking servo.
Note 1: This isn't perfect as no two servos are exactly the same. The servo's will fight each other a little bit so you'll lose some torque
and waste some battery, but it'll probably work good enough.
Note 2: Run your code BEFORE and WHILE you attach the servos. Make sure they are being held at position X and 255-X then mechanically attach the servo horns.
Note 3: The only 100% fullproof way to do this is to use a multimeter on SERVO_B to find an exact value Y for every position of SERVO_A where the servo current is minimal. This is when the two servos are at the same ANGLE and they won't be fighting each other. Put this in a big array and use it to lookup what the value of SERVO_B should be for a given value of SERVO_A.
I was able to reduce the servo motor current by 100-500mA (depending on position) by doing this. But I've met enough people that think doing things right is overkill or "too advanced" so I gave the easy way out first.