Skip to content

Commit

Permalink
think this is what rishay meant lol
Browse files Browse the repository at this point in the history
  • Loading branch information
CrolineCrois committed Oct 26, 2023
1 parent 9593bb3 commit b9bcc66
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/main/java/frc/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class RobotContainer {
private final LukeMech lukeMech;
private final AryaMech aryaMech;


private final int LED_PWM_PORT = 0;

/** The container for the robot. Contains subsystems, OI devices, and commands. */
public RobotContainer() {
Expand All @@ -43,7 +43,7 @@ public RobotContainer() {
vivienMech = new SolenoidMech(pcm2.makeSolenoid(2), 5, 5);

lukeMech = new LukeMech(pcm1.makeSolenoid(0), pcm1.makeSolenoid(0)); //TODO: CHANGEEEEE CHANGEEEE
aryaMech = new AryaMech(pcm2.makeSolenoid(0), pcm2.makeSolenoid(0)); //TODO: CHANGEEEEE CHANGEEEE
aryaMech = new AryaMech(pcm2.makeSolenoid(0), pcm2.makeSolenoid(0), pcm2.makeSolenoid(LED_PWM_PORT)); //TODO: CHANGEEEEE CHANGEEEE
// Configure the trigger bindings
}

Expand Down
13 changes: 6 additions & 7 deletions src/main/java/frc/robot/subsystems/AryaMech.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public class AryaMech extends SubsystemBase{
private Timer timer;
private Solenoid shortSolenoid;
private Solenoid longSolenoid;
private final Solenoid ledStrip;

private double longOut;
private double longIn;
Expand All @@ -28,13 +29,12 @@ public class AryaMech extends SubsystemBase{
private Timer audio_timer;
private final double time_to_wait_before_turning_off_audio_signal;

private final AnalogOutput ledStrip;
private final int LED_PWM_PORT = 0;
private Timer ledTimer;

public AryaMech(Solenoid shortSolenoid, Solenoid longSolenoid){
public AryaMech(Solenoid shortSolenoid, Solenoid longSolenoid, Solenoid ledStrip){
this.shortSolenoid = shortSolenoid;
this.longSolenoid = longSolenoid;
this.ledStrip = ledStrip;

//ik this looks sus but its for ease of change
shortOut = 0;
Expand All @@ -49,7 +49,6 @@ public AryaMech(Solenoid shortSolenoid, Solenoid longSolenoid){
audio_timer = new Timer();
time_to_wait_before_turning_off_audio_signal = 1.0;

ledStrip = new AnalogOutput(LED_PWM_PORT);
ledTimer = new Timer();

timer= new Timer();
Expand All @@ -60,7 +59,7 @@ public AryaMech(Solenoid shortSolenoid, Solenoid longSolenoid){
public void periodic() {

if(ledTimer.hasElapsed(0.25)){
ledStrip.setVoltage(0.0);
ledStrip.set(false);
ledTimer.stop();
ledTimer.reset();
ledTimer.start();
Expand All @@ -85,15 +84,15 @@ else if (timer.hasElapsed(longOut)){
audio_timer.reset(); // setting a timer so that we can stop sending the signal after an appropriate amount of time
audio_timer.start(); // if we don't stop sending the trigger signal, the audio might start playing again

ledStrip.setVoltage(5.0);
ledStrip.set(true);
ledTimer.reset();
ledTimer.start();

longSolenoid.set(true);
}
else if (timer.advanceIfElapsed(longIn)){
longSolenoid.set(false);
ledStrip.setVoltage(0.0);
ledStrip.set(false);
}

}
Expand Down

0 comments on commit b9bcc66

Please sign in to comment.