tried an LED thing (servo)

This commit is contained in:
aarav18
2022-04-07 18:33:44 -06:00
parent 06193efd83
commit a9a7b1bc68
5 changed files with 18 additions and 8 deletions
+1 -1
View File
@@ -168,7 +168,7 @@ public final class Constants {
public static final double STORAGE_SPEED = 1.0;//0.9;
}
public static final class LEDConstants {
public static final int LED_SPARK_ID = 3;
public static final int LED_SPARK_ID = 4;//3;
public static final LEDPatterns DEFAULT_PATTERN = LEDPatterns.SOLID_RED;
public static final LEDPatterns SHOOTING_PATTERN = LEDPatterns.SOLID_GREEN;
@@ -89,7 +89,7 @@ public class RobotContainer {
public final Extender m_robotExtender = new Extender(m_robotMap.extenderMotor);
public final Storage m_robotStorage = new Storage(m_robotMap.storageMotor);
private final LED m_robotLED = new LED(m_robotMap.LEDController); // ! no LED makes aarav sad
private final LED m_robotLED = new LED(m_robotMap.newLED); // ! no LED makes aarav sad
public final BoomBoom m_robotBoomBoom = new BoomBoom(m_robotMap.shooterFalconLeft, m_robotMap.shooterFalconRight);
public final Hood m_robotHood = new Hood(m_robotMap.angleAdjusterMotor);
public final Turret m_robotTurret = new Turret(m_robotMap.shooterTurret);
+2 -1
View File
@@ -53,7 +53,8 @@ public class RobotMap {
}
/* LED Subsystem */
public final Spark LEDController = new Spark(LEDConstants.LED_SPARK_ID);
// public final Spark LEDController = new Spark(LEDConstants.LED_SPARK_ID);
public final Servo newLED = new Servo(LEDConstants.LED_SPARK_ID);
void configureLEDMotorControllers() {}
@@ -6,6 +6,7 @@ package frc4388.robot.subsystems;
import java.util.logging.Logger;
import edu.wpi.first.wpilibj.Servo;
import edu.wpi.first.wpilibj.motorcontrol.Spark;
import edu.wpi.first.wpilibj2.command.SubsystemBase;
import frc4388.robot.Constants.LEDConstants;
@@ -18,13 +19,15 @@ import frc4388.utility.LEDPatterns;
public class LED extends SubsystemBase {
private LEDPatterns m_currentPattern;
private Spark m_LEDController;
private Servo newLED;
// private Spark m_LEDController;
/**
* Add your docs here.
*/
public LED(Spark LEDController){
m_LEDController = LEDController;
public LED(Servo newLED){
// m_LEDController = LEDController;
this.newLED = newLED;
setPattern(LEDConstants.DEFAULT_PATTERN);
updateLED();
Logger.getLogger(LED.class.getSimpleName()).finer("In the Beginning, there was Joe.\nAnd he said, 'Let there be LEDs.'\nAnd it was good.");
@@ -39,7 +42,8 @@ public class LED extends SubsystemBase {
* Add your docs here.
*/
public void updateLED(){
m_LEDController.set(m_currentPattern.getValue());
newLED.setRaw((int) m_currentPattern.percentToPWM());
// m_LEDController.set(m_currentPattern.getValue());
}
/**
@@ -47,7 +51,8 @@ public class LED extends SubsystemBase {
*/
public void setPattern(LEDPatterns pattern){
m_currentPattern = pattern;
m_LEDController.set(m_currentPattern.getValue());
newLED.setRaw((int) m_currentPattern.percentToPWM());
// m_LEDController.set(m_currentPattern.getValue());
}
/**
@@ -42,4 +42,8 @@ public enum LEDPatterns {
public float getValue() {
return id;
}
public float percentToPWM() {
return (1000 + (getValue() * 1000));
}
}