Create a gist now

Instantly share code, notes, and snippets.

getRawButton
package org.usfirst.frc.team4635.robot;
import edu.wpi.first.wpilibj.IterativeRobot;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.livewindow.LiveWindow;
/**
* 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 Robot extends IterativeRobot {
RobotDrive myRobot;
Joystick stick;
Relay mVentana;
/**
* This function is run when the robot is first started up and should be
* used for any initialization code.
*/
public void robotInit() {
myRobot = new RobotDrive(0,1,2,3);
stick = new Joystick(0);
mVentana = new Relay(0);
}
/**
* This function is run once each time the robot enters autonomous mode
*/
public void autonomousInit() {
}
/**
* This function is called periodically during autonomous
*/
public void autonomousPeriodic() {
mVentana.set(Relay.Value.kOn);
mVentana.set(Relay.Value.kForward);
}
/**
* This function is called once each time the robot enters tele-operated mode
*/
public void teleopInit(){
}
/**
* This function is called periodically during operator control
*/
public void teleopPeriodic() {
if(stick.getRawButton(1)==true){
mVentana.set(Relay.Value.kOn);
mVentana.set(Relay.Value.kForward);
}
}
/**
* This function is called periodically during test mode
*/
public void testPeriodic() {
LiveWindow.run();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment