Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

simple lights red when we are in endgame #9

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/main/java/com/team766/robot/OI.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import edu.wpi.first.wpilibj.DriverStation;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;


/**
* This class is the glue that binds the controls on the physical operator
* interface to the code that allow control of the robot.
Expand Down Expand Up @@ -66,6 +67,7 @@ public void run(Context context) {
context.takeOwnership(Robot.drive);
// context.takeOwnership(Robot.intake);
context.takeOwnership(Robot.gyro);
context.takeOwnership(Robot.lights);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should only grab ownership of lights for the small chunk where needed (below) as other mechanisms will also use Lights.


while (true) {
context.waitFor(() -> RobotProvider.instance.hasNewDriverStationData());
Expand All @@ -87,6 +89,9 @@ public void run(Context context) {
// SmartDashboard.putString("Alliance", "NULLLLLLLLL");
// }

if(DriverStation.isTeleop() && DriverStation.getMatchTime() < 30){
Robot.lights.red();
}

if (leftJoystick.getButtonPressed(InputConstants.RESET_GYRO)) {
Robot.gyro.resetGyro();
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/com/team766/robot/Robot.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ public class Robot {
// public static Intake intake;
public static Drive drive;
public static Gyro gyro;
public static Lights lights;

public static void robotInit() {
// Initialize mechanisms here
// intake = new Intake();
drive = new Drive();
gyro = new Gyro();
lights = new Lights();
}
}
5 changes: 5 additions & 0 deletions src/main/java/com/team766/robot/mechanisms/Lights.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,9 @@ public void yellow(){
checkContextOwnership();
candle.setLEDs(255, 255, 0);
}

public void red(){
checkContextOwnership();
candle.setLEDs(255, 0, 0);
}
}