Go Down

Topic: PWM through an Arduino Zero with a Vex Pro Victor Motor Controller (Read 73 times) previous topic - next topic

atfitzsi

Hello,

As the title states, I'm working on a project that requires precise control of a VexPro Victor Motor Controller from an Arduino Zero. I'm attempting to use a simple PWM code (see attached) to test the range of the motor, and what I believe is supposed to occur is that the motor operates at full speed clockwise (forward) when the Pulse Width is 1.0 ms, and full speed counterclockwise (reverse) when the pulse width is 2.0 ms. If my understanding of the Arduino's PWM output is correct, then each of these values should be achieved at 50% duty cycle (where int speed= 127), and 100% duty cycle (int speed=255), respectively. However, when the int speed is set to 127, it operates in the full reverse direction, and only does so as int speed approaches 255. Increasing the value from 127 to 255 only slows down the speed to a near standstill. Any value below 110, and above 256 causes the motor to stop. I thought that it may be possible that the PWM frequencies are different, and considered changing the frequency on the zero to do so, but I'm worried about potentially ruining the board in the process.

Any help in this matter would be appreciated. Thanks.





int motorPin = 3;
 
void setup()
{
  pinMode(motorPin, OUTPUT);
  SerialUSB.begin(9600);
  while (! SerialUSB);
  SerialUSB.println("Speed 0 to 255");
}
 
 
void loop()
{
  if (SerialUSB.available())
  {
    int speed = SerialUSB.parseInt();
   
   
      analogWrite(motorPin, speed);
 
  }
}

Go Up