-
Notifications
You must be signed in to change notification settings - Fork 298
Revise 2027 addressable LEDs documentation for Systemcore #3195
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
Open
Another-Person1
wants to merge
51
commits into
wpilibsuite:2027
Choose a base branch
from
Another-Person1:patch-3
base: 2027
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 7 commits
Commits
Show all changes
51 commits
Select commit
Hold shift + click to select a range
455e723
Revise addressable LEDs documentation for clarity
Another-Person1 4581a74
Apply suggestions from code review
Another-Person1 0b528a2
Apply suggestions from docs review
Another-Person1 2d04c46
Apply suggestions from docs review
Another-Person1 ed9e326
Apply suggestions from docs review
Another-Person1 bfb4496
Update source/docs/software/hardware-apis/misc/addressable-leds.rst
Another-Person1 646d3dd
Update source/docs/software/hardware-apis/misc/addressable-leds.rst
Another-Person1 bf9b975
Apply suggestions from docs review
Another-Person1 5411d96
Update source/docs/software/hardware-apis/misc/addressable-leds.rst
Another-Person1 fc96c5d
Update source/docs/software/hardware-apis/misc/addressable-leds.rst
Another-Person1 75fda75
Update source/docs/software/hardware-apis/misc/addressable-leds.rst
Another-Person1 dd14cc5
Update source/docs/software/hardware-apis/misc/addressable-leds.rst
Another-Person1 c6d969f
Update source/docs/software/hardware-apis/misc/addressable-leds.rst
Another-Person1 d0cc195
Update source/docs/software/hardware-apis/misc/addressable-leds.rst
Another-Person1 3dabdab
Update source/docs/software/hardware-apis/misc/addressable-leds.rst
Another-Person1 e0c5613
Update source/docs/software/hardware-apis/misc/addressable-leds.rst
Another-Person1 b027e55
Update source/docs/software/hardware-apis/misc/addressable-leds.rst
Another-Person1 cc855b8
Update source/docs/software/hardware-apis/misc/addressable-leds.rst
Another-Person1 c84f31b
Update source/docs/software/hardware-apis/misc/addressable-leds.rst
Another-Person1 7ab4845
Update source/docs/software/hardware-apis/misc/addressable-leds.rst
Another-Person1 20ee4f8
Update source/docs/software/hardware-apis/misc/addressable-leds.rst
Another-Person1 f5e4333
Update source/docs/software/hardware-apis/misc/addressable-leds.rst
Another-Person1 abd05ec
Update source/docs/software/hardware-apis/misc/addressable-leds.rst
Another-Person1 24aa6ea
Update source/docs/software/hardware-apis/misc/addressable-leds.rst
Another-Person1 dd5f467
Update source/docs/software/hardware-apis/misc/addressable-leds.rst
Another-Person1 e8ed7b1
Update source/docs/software/hardware-apis/misc/addressable-leds.rst
Another-Person1 bbd9135
Update source/docs/software/hardware-apis/misc/addressable-leds.rst
Another-Person1 85d324a
Update source/docs/software/hardware-apis/misc/addressable-leds.rst
Another-Person1 68cdb8d
Update source/docs/software/hardware-apis/misc/addressable-leds.rst
Another-Person1 3e3d762
Update source/docs/software/hardware-apis/misc/addressable-leds.rst
Another-Person1 11828c3
Update source/docs/software/hardware-apis/misc/addressable-leds.rst
Another-Person1 317b024
Apply suggestion from @Another-Person1
Another-Person1 41aa9ea
Fix docs
Another-Person1 5610467
Update source/docs/software/hardware-apis/misc/addressable-leds.rst
Another-Person1 9c7a6a4
Update source/docs/software/hardware-apis/misc/addressable-leds.rst
Another-Person1 a269713
Update source/docs/software/hardware-apis/misc/addressable-leds.rst
Another-Person1 a5741d7
Update source/docs/software/hardware-apis/misc/addressable-leds.rst
Another-Person1 7478f86
Update source/docs/software/hardware-apis/misc/addressable-leds.rst
Another-Person1 a11134d
Update source/docs/software/hardware-apis/misc/addressable-leds.rst
Another-Person1 0d0b021
updated the addressable LEDs documentation
Another-Person1 2fef28b
made LED timings collapsible and added note recommending against VRM
Another-Person1 393fb60
added resistance note and fixed some stuff, improved wording as well
Another-Person1 d7b5ca4
fixed rst hopefully
Another-Person1 44660f1
fixing stuff
Another-Person1 118a766
fixing build tool errors
Another-Person1 b8f639c
edited some things
Another-Person1 5ee5d69
changed instantiating example to reflect smart io port
Another-Person1 f52730b
implemented feedback
Another-Person1 2fcd6fa
removed ambigious character
Another-Person1 98aa321
fixed headings and other things
Another-Person1 91b9629
fixed redirect error
Another-Person1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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,21 +1,33 @@ | ||
| # Addressable LEDs | ||
|
|
||
| LED strips have been commonly used by teams for several years for a variety of reasons. They allow teams to debug robot functionality from the audience, provide a visual marker for their robot, and can simply add some visual appeal. WPILib has an API for controlling WS2812, WS2812B, and WS2815 LEDs with their data pin connected via :term:`PWM`. | ||
| Addressable LEDs have been commonly used by teams for several years for a variety of reasons. LED strips are the most common, but other form factors such as matrixes and bars are available as well. | ||
|
|
||
|
Another-Person1 marked this conversation as resolved.
|
||
| .. note:: LEDs can be controlled through this API while the robot is disabled. | ||
| They allow teams to debug robot functionality from the audience, provide a visual marker for their robot, and can simply add some visual appeal. WPILib has an API for controlling WS2812, WS2812B, and potentially other LEDs that share the same protocol with their data pin connected to the SIGNAL pin of a SMART I/O connector. These types of addressable LEDs are also referred to as NeoPixels by other companies. | ||
|
Another-Person1 marked this conversation as resolved.
Outdated
Another-Person1 marked this conversation as resolved.
Outdated
|
||
| .. note:: This library only supports WS2812B-compliant addressable LED products (strips, bars, matrixes,etc.) | ||
|
Another-Person1 marked this conversation as resolved.
Outdated
|
||
|
|
||
| Unlike the roboRIO, the Systemcore supports multiple addressable LED products at once. | ||
|
Another-Person1 marked this conversation as resolved.
Outdated
|
||
|
|
||
| HUB-75 LED matrixes, DotStar LEDs, and other types of addressable LED products are not supported by this API. In addition to that, some WS2812B-compliant strips with different timings (WS2815, etc.) may not work. | ||
|
Another-Person1 marked this conversation as resolved.
Outdated
|
||
|
|
||
| .. important:: The roboRIO can only control **one** ``AddressableLED`` object at a time through its PWM ports. Attempting to create multiple ``AddressableLED`` objects will result in a HAL allocation error. If you need to control multiple physical LED strips, you have several options: | ||
|
Another-Person1 marked this conversation as resolved.
|
||
| Timings: | ||
|
Another-Person1 marked this conversation as resolved.
Outdated
|
||
|
|
||
|
Another-Person1 marked this conversation as resolved.
|
||
| - **Daisy-chain strips in series**: Connect multiple LED strips end-to-end as a single long strip, then use :ref:`buffer views <docs/software/hardware-apis/misc/addressable-leds:Controlling Sections of an LED Strip>` to control different sections independently | ||
| - **Use PWM Y-cables**: If you need identical patterns on multiple strips, use PWM Y-cables to send the same signal to multiple strips simultaneously | ||
| T0H: 375ns | ||
|
Another-Person1 marked this conversation as resolved.
Outdated
|
||
| T0L: 875ns | ||
|
Another-Person1 marked this conversation as resolved.
Outdated
|
||
| T1H: 750ns | ||
|
Another-Person1 marked this conversation as resolved.
Outdated
|
||
| T1L: 500ns | ||
|
Another-Person1 marked this conversation as resolved.
Outdated
|
||
| .. note:: LEDs can be controlled through this API while the robot is disabled. | ||
|
Another-Person1 marked this conversation as resolved.
Outdated
|
||
|
|
||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add a note about timing not being configurable like roboRIO |
||
| .. seealso:: For detailed information about powering and best practices for addressable LEDs, see the [Adafruit NeoPixel Überguide](https://learn.adafruit.com/adafruit-neopixel-uberguide/powering-neopixels). | ||
|
Another-Person1 marked this conversation as resolved.
Outdated
|
||
|
|
||
| .. warning:: WS2812B LEDs are designed for 5V, but roboRIO PWM/Servo ports output 6V. While the LEDs will function, this may reduce their lifespan. Consider using a voltage regulator or level shifter if longevity is a concern. | ||
| .. note:: WS281x LEDs (with the exception of the WS2815, see below warning) are designed for **5V**, but Systemcore ports output **3.3V**. This may cause issues with some LED strips, and a logic level shifter is needed, such as the [Adafruit Pixel Shifter](https://www.adafruit.com/product/6066). | ||
|
|
||
| .. note:: The 300-500 Ohm data line resistor and large 1000μF capacitor across the power pins are recommended, especially with larger quantities of LEDs. Also, use an external 5V regulator to power the LEDs, with the **grounds** tied together. | ||
|
|
||
| .. warning:: WS2815 LEDs (and maybe other products as well, **check the label**) are designed for **12V** but have **5V** data (see above note). The **backup line on the first strip** needs to be connected to **ground**, **not** connected to the data line despite what other guides may say. | ||
|
|
||
|
Another-Person1 marked this conversation as resolved.
|
||
| ## Instantiating the AddressableLED Object | ||
|
|
||
| You first create an ``AddressableLED`` object that takes the PWM port as an argument. It *must* be a PWM header on the roboRIO. Then you set the number of LEDs located on your LED strip, which can be done with the ``setLength()`` function. | ||
| You first create an ``AddressableLED`` object that takes the SMART I/O port as an argument. Then you set the number of LEDs located on your LED strip, which can be done with the ``setLength()`` function. | ||
|
Another-Person1 marked this conversation as resolved.
Outdated
|
||
|
|
||
| .. warning:: It is important to note that setting the length of the LED header is an expensive task and it's **not** recommended to run this periodically. | ||
|
|
||
|
|
@@ -49,7 +61,7 @@ After the length of the strip has been set, you'll have to create an ``Addressab | |
|
|
||
| ## Controlling Sections of an LED Strip | ||
|
|
||
| The roboRIO can only control a single addressable LED output at a time, but there are often multiple physical LED strips daisy-chained around a robot, or a single flexible LED strip wrapped around structures on a robot. Individual sections can be accessed in Java using ``AddressableLEDBufferView``. Buffer views behave like subsections of the larger buffer, and can be accessed using indices in the typical [0, length) range. They can also be reversed, to allow for parallel serpentine sections to be animated in the same physical orientation (i.e. both sections would animate "forward" in the same direction, even if the strips are physically tip-to-tail). | ||
| Individual sections can be accessed in Java using ``AddressableLEDBufferView``. Buffer views behave like subsections of the larger buffer, and can be accessed using indices in the typical [0, length) range. They can also be reversed, to allow for parallel serpentine sections to be animated in the same physical orientation (i.e. both sections would animate "forward" in the same direction, even if the strips are physically tip-to-tail). | ||
|
|
||
| .. tab-set:: | ||
|
|
||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.