-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SPIKE: Addressable LEDs #14
Comments
static LEDPattern rainbow (int saturation, int value) The saturation is the intensity of the color. For example, dark blue versus light blue. The value is the color itself. 0 is black, while 255 is white. Both saturation and intensity go from a value of 0 to 255. A gradient is set up like this: static LEDPattern gradient (LEDPattern.GradientType type, Colors...Colors. The type refers to the "type of gradient": either discontinuous or continuous. Colors refer to the colors you'll display within the gradient. They can be written in either a HEX pattern or RGB values. The Google Color Picker can give you both HEX and RGB values. (Look up color picker on Google). A solid color block is set up like this: static LEDPattern solid (Color color) The color (keep the uppercase, only change the lowercase) refers to the color you want. There are different codes you can place in for each color. For example, Color kCyan would automatically place a cyan color on the LED strip. For more codes, refer to this link: https://github.wpilib.org/allwpilib/docs/release/java/edu/wpi/first/wpilibj/util/Color.html
private final AdressableLEDBuffer m_ledBuffer The buffer then needs to get the length of the LED strip measured by the amount of LEDs on the strip. This will allow for the pattern to be displayed on the LED strip with the right proportions. m_ledBuffer = new AddressableLEDBuffer(60); 60 refers to the length of the LED strip. Setters and getters are also used. The data is then set to the buffer so it can be translated into readable code. m_led.setData(m_ledBuffer);
The LED pattern is set to buffer within a periodic function (every 20 milliseconds, the code will look at where the colors are and adjust to continue with the pattern. public void robotPeriodic() { "m_scrollingRainbow" can be substituted with any type of color animation. Refer to Step 1 for three of the coolest (and simplest to explain) patterns you can use. There are other variables and steps required, but this comment should clear up the main requirements specific to LED strips themselves. Refer to the link at the introduction to look at example code. Thank you! |
Using LED strips is a really good way to provide driver feedback, we need to figure out how to use them for this season. Do some research into WPILib's addressable LED features, as well as determining what our LED inventory looks like
Resources
Addressable
JavaDocsAddressable
Example Project (Java)Criteria
The text was updated successfully, but these errors were encountered: