Skip to content

Commit 59f170c

Browse files
RGBLights (#17)
* Working on RGB Strip to signal to Human Player what pixel to pick. I created an Array to hold the different colors. * Working on RGB Strip to signal to Human Player what pixel to pick. I created an Array to hold the different colors. * Complete with RGB lights for signaling to human player * Complete with RGB lights for signaling to human player * Complete with RGB lights for signaling to human player * Complete with RGB lights for signaling to human player * Class for the LED lights. Can be used to set colors for the LEDs & create a cool pattern in auto(For now, it is just alternating between blue & yellow every five seconds, but will be changed to have the pattern say "8693" in binary * Class for the LED lights. Can be used to set color or create a pattern
1 parent 14c977f commit 59f170c

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
package org.firstinspires.ftc.teamcode.subsystems;
2+
3+
import static android.icu.lang.UProperty.MATH;
4+
import static android.icu.lang.UProperty.PATTERN_SYNTAX;
5+
import static java.lang.Thread.sleep;
6+
7+
import com.qualcomm.hardware.rev.RevBlinkinLedDriver.BlinkinPattern;
8+
import com.qualcomm.robotcore.hardware.HardwareMap;
9+
import com.qualcomm.robotcore.util.ElapsedTime;
10+
11+
import org.firstinspires.ftc.teamcode.utils.GamepadEvents;
12+
import org.firstinspires.ftc.teamcode.utils.RGBLights;
13+
14+
15+
public class RGBcontroller extends RGBLights {
16+
17+
18+
ElapsedTime secondsPassed = new ElapsedTime();
19+
BlinkinPattern[] rgbArray;
20+
21+
public RGBcontroller(String name, HardwareMap hw) {
22+
super(hw, name);
23+
rgbArray = new BlinkinPattern[]{BlinkinPattern.BLUE, BlinkinPattern.BLUE};
24+
25+
26+
}
27+
28+
//Take in two parameters of color and alternate between them every second
29+
public void setColor(BlinkinPattern color) {
30+
super.setPattern(color);
31+
32+
}
33+
34+
public void setColor(BlinkinPattern color0, BlinkinPattern color1) {
35+
secondsPassed.reset();
36+
rgbArray[0] = color0;
37+
rgbArray[1] = color1;
38+
}
39+
40+
public void update() {
41+
super.setPattern(rgbArray[secondsPassed.seconds() % 1 < 0.5 ? 0 : 1]);
42+
}
43+
}

0 commit comments

Comments
 (0)