-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #54 from 2491-NoMythic/lights-)
Lights trying to merge
- Loading branch information
Showing
7 changed files
with
111 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// Copyright (c) FIRST and other WPILib contributors. | ||
// Open Source Software; you can modify and/or share it under the terms of | ||
// the WPILib BSD license file in the root directory of this project. | ||
|
||
package frc.robot.commands; | ||
|
||
import edu.wpi.first.wpilibj2.command.Command; | ||
import frc.robot.subsystems.Lights; | ||
import frc.robot.subsystems.RobotState; | ||
public class IndicatorLights extends Command { | ||
|
||
Lights lights; | ||
|
||
public IndicatorLights(Lights lights) { | ||
addRequirements(lights); | ||
this.lights = lights; | ||
} | ||
|
||
|
||
@Override | ||
public void initialize() {} | ||
|
||
@Override | ||
public void execute() { | ||
if (RobotState.getInstance().IsNoteSeen) { | ||
lights.setSectionOne(50,40,0); | ||
} else { | ||
lights.setSectionOne(50, 0, 50); | ||
} | ||
if (RobotState.getInstance().ShooterInRange && RobotState.getInstance().ShooterReady){ | ||
lights.setSectionTwo(0,50,0); | ||
} else if (RobotState.getInstance().ShooterInRange){ | ||
lights.setSectionTwo(50, 50, 0); | ||
} else { | ||
lights.setSectionTwo(50, 0, 50); | ||
} | ||
lights.dataSetter(); | ||
} | ||
|
||
|
||
@Override | ||
public void end(boolean interrupted) { | ||
lights.lightsOut(); | ||
lights.dataSetter(); | ||
} | ||
|
||
// Returns true when the command should end. | ||
@Override | ||
public boolean isFinished() { | ||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package frc.robot.subsystems; | ||
|
||
public class RobotState { | ||
private static RobotState instance; | ||
public boolean IsNoteSeen; | ||
public boolean ShooterInRange; | ||
public boolean ShooterReady; | ||
|
||
private RobotState() { | ||
|
||
} | ||
|
||
public static RobotState getInstance() { | ||
if (instance == null) { | ||
instance = new RobotState(); | ||
} | ||
return instance; | ||
} | ||
} |