My team and I have been trying to get our old robot running and the Digital Sidecar isn’t responding to I/O commands. I can control a relay (spike) just fine, but we can’t control the victor at all. It’s just flashing orange. We know the PWM cable is good and the code is just very simple and should work. Also every node from the Digital I/O section of the Digital sidecar is giving out a constant 5v. Any help appreciated, I’ll also post my code here in-case that may be the problem.
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2008. 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 edu.wpi.first.wpilibj.templates;
import edu.wpi.first.wpilibj.IterativeRobot;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.Relay;
import edu.wpi.first.wpilibj.Victor;
/**
* The VM is configured to automatically run this class, and to call the
* functions corresponding to each mode, as described in the IterativeRobot
* documentation. If you change the name of this class or the package after
* creating this project, you must also update the manifest file in the resource
* directory.
*/
public class RobotTemplate extends IterativeRobot {
/**
* This function is run when the robot is first started up and should be
* used for any initialization code.
*/
//ADXL345_I2C accel;
Relay spike;
Joystick joy;
Victor vict;
public void robotInit() {
//accel = new ADXL345_I2C(1,ADXL345_I2C.DataFormat_Range.k2G);
spike = new Relay(1);
vict = new Victor(1);
joy = new Joystick(1);
}
/**
* This function is called periodically during autonomous
*/
public void autonomousPeriodic() {
}
/**
* This function is called periodically during operator control
*/
public void teleopPeriodic() {
//System.out.println("Acceleration X: " + accel.getAcceleration(ADXL345_I2C.Axes.kX));
System.out.println("Joystick Y:" + joy.getY());
vict.set(joy.getY());
if(joy.getAxis(Joystick.AxisType.kY)<0)
{
spike.set(Relay.Value.kForward);
System.out.println("Spike reverse");
}
else if(joy.getAxis(Joystick.AxisType.kY)>0)
{
spike.set(Relay.Value.kReverse);
System.out.println("Spike reverse");
}
}
}