Arduino Microcontroller

I am making a Microcontroller to run a vex robot off of but I have run into a problem. My motors seem to want to continue to run when the motor values are set to 0 power. it takes the power set to 22 in the opposite direction that they want to turn to keep them still. So I want to know if anyone has run into this issue and how they fixed it

1 Like

I’ve run Vex motors and servos (and other Vex motor controllers) from an Arduino and haven’t noticed an offset.

The servo stop command is a 1ms pulse, so if the clock on your Arduino is off, then the pulse can be too long or short resulting in the bias you see. What flavor of Arduino are you using, and have you tried the same code on any other Arduino’s?

What library are you using? In the standard Arduino Servo library, a value of 90 should correspond with stopped, not 0.

Also, apparently AnalogWrite() signals on pins 5 and 6 generate pulses that are slightly too long at low duty-cycle values, so you might want to make sure you are using other pins.


  • Dean

what motors are you trying to run? The 3 wire motors should run just fine if coded correctly, but the 2 wire motors need either a motor shield or you need motor controllers to run them. Either way, the programming is the same.

I am using an Arduino Uno board and I am trying to use 3 wire motors. I am using RobotC for Arduino to program it because I am more familiar with the RobotC programming language.

The set up for the bread board that I am using is that I have a 12V (or 9V if I want) supplying direct power to the motors. I then have wires connecting the arduino board to the motor’s data wires. The Arduino board is getting power from the computer when it is plugged in.

The issue only happens when the motors are both connected to the battery and when receiving info via the data wires.

this is a copy of my code:

Ah, I’ve never used RobotC on Arduino before. I’ll give it a try this evening and see if I can reproduce what you are seeing.


  • Dean

Sounds good, thank you for the assistance.

I think I have found the issue, I think that the duty cycle is off so that the 0 power is not really stopping it. The issue I now have is that I can find any obvious way to control the duty cycle via RobotC

Just thought I would throw my two cents in. I have done this in the past, and I am currently doing what you are doing now, except I am using the Arduino IDE to program. Instead of just using analogWrite();, I am using the servo library, since the 3 wire motors are servos.

servo.write(0); // Counterclockwise all the way
servo.write(90); // Stopped
servo.write(180); // Clockwise all the way