diff --git a/src/main/java/frc/robot/Constants.java b/src/main/java/frc/robot/Constants.java index a2f0138..e1c5acf 100644 --- a/src/main/java/frc/robot/Constants.java +++ b/src/main/java/frc/robot/Constants.java @@ -22,6 +22,11 @@ * constants are needed, to reduce verbosity. */ public final class Constants { + public class BlinkinConstants { + + public static final int kBlinkinPort = 0; + + } public static final class DriveConstants { diff --git a/src/main/java/frc/robot/subsystems/BlinkinSubsystem.java b/src/main/java/frc/robot/subsystems/BlinkinSubsystem.java new file mode 100644 index 0000000..19d444c --- /dev/null +++ b/src/main/java/frc/robot/subsystems/BlinkinSubsystem.java @@ -0,0 +1,67 @@ +// 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.subsystems; + +import java.util.function.BooleanSupplier; + +import edu.wpi.first.wpilibj.motorcontrol.Spark; +import edu.wpi.first.wpilibj2.command.SubsystemBase; +import frc.robot.Constants.BlinkinConstants; +import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard; +import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab; + + +public class BlinkinSubsystem extends SubsystemBase { + + private final ShuffleboardTab m_tab = Shuffleboard.getTab("Blinkin"); + + private final Spark blinkin; + + public BlinkinSubsystem() { + blinkin = new Spark(BlinkinConstants.kBlinkinPort); + m_tab.add(blinkin.toString(), blinkin); + } + + public BooleanSupplier supplier = () -> {return false;}; + + @Override + public void periodic() { + if (supplier.getAsBoolean()) + setGreen(); + // This method will be called once per scheduler run + } + + public void set(double pattern) { + blinkin.set(pattern); + } + + public void setOcean(){ + blinkin.set(-0.95); + } + + public void setRainbow(){ + blinkin.set(-0.99); + } + + public void setBlue(){ + blinkin.set(0.87); + } + + public void setGreen(){ + blinkin.set(0.77); + } + + public void setRed(){ + blinkin.set(0.61); + } + + public void setWhite(){ + blinkin.set(0.93); + } + @Override + public void simulationPeriodic() { + // This method will be called once per scheduler run during simulation + } +} \ No newline at end of file