-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathAddressableLEDTestCommand.java
More file actions
53 lines (45 loc) · 1.47 KB
/
AddressableLEDTestCommand.java
File metadata and controls
53 lines (45 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package frc.robot.commands.test;
import static edu.wpi.first.units.Units.MetersPerSecond;
import static edu.wpi.first.units.Units.Seconds;
import edu.wpi.first.wpilibj.LEDPattern;
import edu.wpi.first.wpilibj.util.Color;
import edu.wpi.first.wpilibj2.command.Command;
import frc.robot.subsystems.addressableled.AddressableLEDConstants;
import frc.robot.subsystems.addressableled.AddressableLEDSubsystem;
public class AddressableLEDTestCommand extends Command {
private final AddressableLEDSubsystem ledSystem;
private LEDPattern currentPattern;
private int ticker = 0;
private int testCount = 0;
public AddressableLEDTestCommand(AddressableLEDSubsystem ledSystem) {
this.ledSystem = ledSystem;
addRequirements(ledSystem);
}
@Override
public void initialize() {
ticker = 0;
testCount = 0;
currentPattern = LEDPattern.rainbow(255, 128).scrollAtAbsoluteSpeed(MetersPerSecond.of(1), AddressableLEDConstants.LED_DENSITY);
}
@Override
public void execute() {
if(ticker < 500) {
ticker++;
} else {
ticker = 0;
testCount++;
if(testCount == AddressableLEDConstants.SECTIONS.length) {
currentPattern = LEDPattern.solid(Color.kLimeGreen).breathe(Seconds.of(2));
}
}
}
@Override
public boolean isFinished() {
return testCount < (AddressableLEDConstants.SECTIONS.length + 1);
}
@Override
public void end(boolean interrupted) {
// TODO Auto-generated method stub
super.end(interrupted);
}
}