Programming Trim in EasyC v4

I’ve been having problems programming a trim into my operator control functions; unlike the old controller where it was merely a convenient slide to change the trim, the new controllers do not posess such a function, so I’ve been trying to program a trim.
But alas, I’ve been unable to program it properly; either the motor will merely run by itself, the function will only run once, or the output of the motor seems to be reduced. Any ideas?

ya, weve been having that same problem, our arm goes down a tiny bit because of the trim

https://vexforum.com/t/answered-does-vexnet-controller-have-trim/17030/1
that was an offical post by a vex superviser person. it says you dont have trim you have to handle it in the user control of the microcontroller, then it says you can set a large dead band for neutral, set limits …etc if needed.

I’ll try to help you guys out as best I can. I do need to know if you want to trim to run constantly, or only at specific times. Sadly I only know how to program it if a button is pressed. So the basic format for this is pretty simple. Lets say I want motor 1 to run trim when button 1 on that channel is pressed. You would have to start by making a variable for something like “button_1”. From there you would want to do an if function in your driver control. It would look something like:

if (button_1) == 1 (if button 1 is pressed)
Motor 1 at 45 (Run motor 1 at 45 power)

You can also do some more complicated stuff than this, like for my team, we programmed it to run trim while a button is pressed, and after it is pressed until another specific button is pressed. If you would like to do something like this, let me know and I’ll take a look at my program. Hope this helps, and someone please correct me if I’m a little off on this, cuz I’m still a little new to programmin :wink:

Vexnet Controller joystick zeroing can be done by some sequence of config+buttons.

For multi-motor drive train, the simplest programming is the built-in tank2/tank4/arcade2/arcade4 functions. If you have 6 motors, then use both a 2 and a 4 until you run out of motors.

The most complex programming: If each motor needs different tweaking, then you may want to build a custom lookup table that reads the joystick value, and custom calculates a value to send to each motor.

In the middle complexity “just right…” is a constant trim offset, like this:


  SetMotor( motornum, trimvar + GetJoystickAnalog());

This may require trial&error programming to set the trimvar correctly.
If you set the trim value from a spare poteniometer, then you can just twist the gear-pot while driving around until it works, then print out the trim value.

  trimvar = GetAnalogInput()*scale -offset; // want range from -100 to +100
  SetMotor( motornum, trimvar + GetJoystickAnalog());
  PrintToScreen( "Trim set to %d\n",trimvar); // remove once it works 

This just moves the trim knob from the Old RC controller to a pot/knob on the robot.

To do this you simply press and hold the CONFIG and 6U buttons for a couple seconds, until the JOYSTICK light starts flashing green/red, you then have 10 seconds to do the following: Move both joysticks to their full up, down, left, and right positions, then press the 8U button to save the calibration. There is a guide on how to do this here.

~Jordan

The instructions you posted have a RobotC heading. Will the same calibration procedure work for EasyC? If the joystick firmware is the same it should. Does anyone know?

you also could program the button you want to use for controlling the system that needs trim to a variable. then you would use an IF pressed then raise ELSE motor x 15 or whatever would be needed in the situation

Yes, actually here is the one posted by VEX Robotics. (For some reason I couldn’t find that one before.) So I’m sure that this method will work exactly the same for both ROBOTC and easyC.

~Jordan