-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
no need to write an essay - David
- Loading branch information
Showing
3 changed files
with
25 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 22 additions & 8 deletions
30
src/main/java/com/team841/calliope/superstructure/lights/LEDIOSpark.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,45 @@ | ||
package com.team841.calliope.superstructure.lights; | ||
|
||
import com.team841.calliope.constants.SC; | ||
|
||
import edu.wpi.first.wpilibj.AddressableLED; | ||
import edu.wpi.first.wpilibj.AddressableLEDBuffer; | ||
import edu.wpi.first.wpilibj.motorcontrol.Spark; | ||
|
||
public class LEDIOSpark implements LEDIO{ | ||
private final Spark LED = new Spark(SC.Intake.kBlinkingID); | ||
private final AddressableLED LED = new AddressableLED(5); | ||
private final AddressableLEDBuffer Buffer = new AddressableLEDBuffer(59); | ||
|
||
|
||
public LEDIOSpark() { | ||
|
||
LED.setLength(Buffer.getLength()); | ||
LED.setData(Buffer); | ||
LED.start(); | ||
} | ||
|
||
@Override | ||
public void updateInputs(LedIOInputs inputs) { | ||
inputs.sparkOutput = LED.get(); | ||
// inputs.sparkOutput = LED.get(); | ||
} | ||
|
||
@Override | ||
public void setColor(String color){ | ||
switch (color) { | ||
case "Violet" -> LED.set(0.91); | ||
case "Green" -> LED.set(.77); | ||
case "Orange" -> LED.set(.65); | ||
if(color == "red"){ | ||
for(var i = 0; i < Buffer.getLength(); i++) | ||
Buffer.setRGB(i, 255, 0, 0); | ||
LED.setData(Buffer); | ||
} | ||
if(color == "green"){ | ||
for(var i = 0; i < Buffer.getLength(); i++) | ||
Buffer.setRGB(i, 0, 255, 0); | ||
LED.setData(Buffer); | ||
} | ||
|
||
|
||
} | ||
|
||
@Override | ||
public void set(double value) { | ||
LED.set(value); | ||
// LED.set(value); | ||
} | ||
} |