Place the flowing code where your joysticks are being declared
Code:
Relay spike = new Relay(4,1);
Then put the flowing in the method teleopPeriodic()
Code:
/*
assumes that you want the spike to turn on if the triger is pressed on a joystick named m_leftStick
*/
if(m_leftStick.getRawButton(1)){
spike.set(Relay.Value.kForward);
}
else{
spike.set(Relay.Value.kOff);
}