How do you code a 393 motor in v5 using a 3 wire port?

Hi, we are trying to program a 393 motor in C++ and don’t know how to program it as a 3-wire device. How would you go about doing this? Thanks

1 Like

You can’t use 393 motors in composition. In VCS you need to use C++ Pro in the .h file you can add the 393 motor from the side pannel then use it just like a v5 motor just with out any of the v5 features.

Even though it isn’t competition legal, there is a vex::motor29 class in VCS. Check out the API (link) to see specific calls.

2 Likes

I use the 393 motor to V5 brain. It works.
1.Use the 29motor controller to connect the 393 motor
2. insert 3-wire port to V5 brain port
3. programIMG_20190516_232312

3 Likes

may I ask why you might want to do this. Just curious.

For example, I have only had enough money for 4 motors. I have like 6 393s because I fixed up motors my coach threw out. I can use those for smaller-load purposes, since they are for me, not a team.

2 Likes

It was originally for the Create US Open Division so that we could split the load on the battery between the old battery and the new one

3 Likes

Linked below are several posts that have more information about controlling 393 motor connected to a 3-wire legacy port on V5 brain (obviously, via MC29 motor controller).

The keyword to know is vex::pwm_out class:

6 Likes

Can you share me the code? thanks

mmexport1559143294400

program

1 Like

i think some people came here to see the code, so here is what i have.

vex::motor29 motor2( Brain.ThreeWirePort.A )
    while(true) {
  if(Controller.ButtonY.pressing()) {
        motor2.spin(directionType::fwd, 127, velocityUnits::pct);
    }
    else if(Controller.ButtonA.pressing()) {
        motor2.spin(directionType::rev, 127, velocityUnits::pct);
    }
    else {
        motor2.stop();
    }
2 Likes

I was able to get the 393 motor running on the V5 brain but no luck getting it to run with the V5 remote control. Has anyone had any success with that or is is just able to be programmed with the V5 blocks and not remote controllable?

If I understand what you’re saying, I think you will need to write a custom program for the controller. There are no “canned routines” that incorporate the legacy ports on a V5 brain

2 Likes