Log in

View Full Version : spike relay code urgent


chris janney
21-02-2010, 14:33
ok hi all
ok i am a part of our mechanical team, and our programmer isnt here. we ship in two days and our spike relay isnt programmed. can someone please show me the nessacary coding for it. if it helps we are using java.

Trevor_Decker
21-02-2010, 17:55
Place the flowing code where your joysticks are being declared


Relay spike = new Relay(4,1);


Then put the flowing in the method teleopPeriodic()

/*
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);
}