Programming Talon PWM - Java

So we are trying to program with TalonSRX this year. I Have tried programming with the examples in VSCode and various other examples but I have not been able to get the Talons and my robot to move. We have tried using the Y cable and each individual PWM cables.

On our old robot we were using VictorSp and VictorSPX. These both seem to work but can’t get the Talons to operate.

Any help will be beneficial.

Check polarity on the PWM Cable (rotate 180 degree’s)

Are you using PWMTalonSRX class?

Doles your constructor have the correct PWM channel on the Rio?

Post code so we can see…


Yes using the PWMTalonSRX class

Using the Y cable to connect to ports 0 and 1 respectively.

Currently testing the example code from VS code using tank drive.


/* Copyright © 2017-2018 FIRST. All Rights Reserved. /
Open Source Software - may be modified and shared by FRC teams. The code /
must be accompanied by the FIRST BSD license file in the root directory of /
the project. /

package frc.robot;

import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.PWMTalonSRX;
import edu.wpi.first.wpilibj.TimedRobot;


  • This is a demo program showing the use of the RobotDrive class, specifically
  • it contains the code necessary to operate a robot with tank drive.
    public class Robot extends TimedRobot {
    private DifferentialDrive m_myRobot;
    private Joystick m_leftStick;
    private Joystick m_rightStick;

public void robotInit() {
m_myRobot = new DifferentialDrive(new PWMTalonSRX(0), new PWMTalonSRX(1));
m_leftStick = new Joystick(0);
m_rightStick = new Joystick(0);

public void teleopPeriodic() {
m_myRobot.tankDrive(m_leftStick.getY(), m_rightStick.getY());

Look at your Joystick constructors. You are creating 2 joysticks both on port 0.

1 Like

I tried multiple different controller configurations. Only using one controller right now. Also tried the arcade drive example code with the same result.

What are the SRX LEDs doing, both when joysticks are at zero, and when you’re trying to drive forward or reverse?

Flashing red under all instances.

Like this?

Indication: Both LEDs quickly blink red then off. First one LED blinks red, followed immediately by the other, then finally both LEDs are off for a small period of time.
Problem:Limit Switch or Soft Limit Activated

Or together, or alternating, or strobing one direction or the other?

They don’t blink quickly it’s more of a standard pattern of blinking. I feel like they are not either being instantiated or activated

Blinking together


private SpeedController m_Left;
private SpeedController m_Right;

m_Left = new PWMTalonSRX(0);
m_Right = new PWMTalonSRX(1);
m_myRobot = new DifferentialDrive(m_Left, m_Right);
m_leftStick = new Joystick(0);
m_rightStick = new Joystick(1);

Make sure your DS has the Joysticks in the correct USB port.

That seems to indicate that you have reverse throttle all the time (?) or a failed calibration.

The blink codes are on page 32 here:

I think the lights were blinking together but they could’ve been alternating I will have to check that tomorrow I have already left for the night from our lab.

Any chance of a photo of your wiring setup?

What is this Y cable you have mentioned several times?

The lights are alternating which would indicate no pwm signals.

The Y cable links the left motors to 1 pwm signal and same for the right side.

Do the yellow wires on the SRXs connect to the PWM port 0 and 1 pins marked “S” on the RIO, and the green to the Ground symbol ⏚? If reversed or not connected there, this would cause the “no pwm” condition.

I was not there today but the robot got rewired with spark motor controllers and still did not have success. I don’t have the code that was changed but here are the pictures that was sent to me today. We used these sparks last year with no issues.

After rewiring with sparks the colors change indicating that sparks were receiving from the signals from the pwm but did not get any movement.

Um - I see four SPARK [original] motor controllers and zero Talon [anything] motor controllers in your pics. What are you actually using?

Updated above. Robot was rewired today with sparks.