From b9bcc662a6ae661ce98d7918c281c0850922bf4f Mon Sep 17 00:00:00 2001 From: CrolineCrois Date: Thu, 26 Oct 2023 15:25:51 -0700 Subject: [PATCH] think this is what rishay meant lol --- src/main/java/frc/robot/RobotContainer.java | 4 ++-- src/main/java/frc/robot/subsystems/AryaMech.java | 13 ++++++------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index e72046d..a3255fa 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -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() { @@ -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 } diff --git a/src/main/java/frc/robot/subsystems/AryaMech.java b/src/main/java/frc/robot/subsystems/AryaMech.java index 3bcee4f..2f28254 100644 --- a/src/main/java/frc/robot/subsystems/AryaMech.java +++ b/src/main/java/frc/robot/subsystems/AryaMech.java @@ -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; @@ -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; @@ -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(); @@ -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(); @@ -85,7 +84,7 @@ 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(); @@ -93,7 +92,7 @@ else if (timer.hasElapsed(longOut)){ } else if (timer.advanceIfElapsed(longIn)){ longSolenoid.set(false); - ledStrip.setVoltage(0.0); + ledStrip.set(false); } }