mirror of
https://github.com/Team4388/2019-Hit-or-Miss.git
synced 2026-06-09 08:38:06 -06:00
Set up LEDs
This commit is contained in:
@@ -32,15 +32,11 @@ public class Robot extends TimedRobot
|
||||
public static final Drive drive = new Drive();
|
||||
public static final Arm arm = new Arm();
|
||||
public static final Wrist wrist = new Wrist();
|
||||
|
||||
|
||||
|
||||
public static final BallIntake ballIntake = new BallIntake();
|
||||
|
||||
|
||||
|
||||
public static final Climber climber = new Climber();
|
||||
public static final Pneumatics pnumatics = new Pneumatics();
|
||||
public static final Pneumatics pnumatics = new Pneumatics();
|
||||
public static final LED led = new LED();
|
||||
|
||||
public static final long periodMS = 10;
|
||||
public static final ControlLooper controlLoop = new ControlLooper("Main control loop", periodMS);
|
||||
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
package org.usfirst.frc4388.robot.constants;
|
||||
|
||||
public enum LEDPatterns {
|
||||
RED(0.61f), BLACK(0.99f);
|
||||
|
||||
private final float id;
|
||||
LEDPatterns(float id) { this.id = id; }
|
||||
public float getValue() { return id; }
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) 2018 FIRST. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
package org.usfirst.frc4388.robot.subsystems;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.usfirst.frc4388.robot.constants.LEDPatterns;
|
||||
|
||||
import edu.wpi.first.wpilibj.Spark;
|
||||
import edu.wpi.first.wpilibj.command.Subsystem;
|
||||
|
||||
/**
|
||||
* Add your docs here.
|
||||
*/
|
||||
public class LED extends Subsystem {
|
||||
|
||||
public static final int LED_SPARK_ID = 0;
|
||||
public static float currentLED;
|
||||
public Spark LEDController = new Spark(LED_SPARK_ID);
|
||||
|
||||
public LED(){
|
||||
setPattern(LEDPatterns.RED);
|
||||
}
|
||||
|
||||
public void periodic() {
|
||||
LEDController.set(currentLED);
|
||||
}
|
||||
|
||||
public void setPattern(LEDPatterns pattern){
|
||||
currentLED = pattern.getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initDefaultCommand() {
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user