garykac / amhs-robotics-4681

Repository for AMHS's FRC (FIRST Robotics Competition) team
3 stars 0 forks source link

Add limit switch to the code for ball intake #29

Closed Team4681 closed 5 years ago

Team4681 commented 5 years ago

Java

import edu.wpi.first.wpilibj.DigitalInput; import edu.wpi.first.wpilibj.SampleRobot; import edu.wpi.first.wpilibj.Timer;

public class RobotTemplate extends SampleRobot {

DigitalInput limitSwitch;

public void robotInit() {
    limitSwitch = new DigitalInput(1);
}

public void operatorControl() {
    // more code here
    while (limitSwitch.get()) {
        //whatever you want to happen
    }
}

}

cmarley3-14 commented 5 years ago

added and working