Requirements
- PROS 4.x or later
- VEX V5 brain
- WS2812B-compatible LED strip wired to a VEX ADI port
Install via PROS CLI
pros c fetch https://github.com/advisorylabs/hitlib/releases/download/1.3.0/hitlib@1.3.0.zip
pros c apply hitlib
Or paste the URL directly into the Install Template dialog in the PROS VS Code extension.
Check the Releases page for the latest version and swap the version number above if a newer one is available.
Include the library
Add one include at the top of your main.h or any file that uses hitlib:
Top-level convenience header, includes the full hitlib public API.
To use the built-in profiles, also include:
Ready-made Classic, Modern and Showy LED profiles.
ADI expander
If your strip is on an ADI expander connected to a smart port:
Driver for a single WS2812B-compatible LED strip on a VEX ADI port.
Definition led_strand.hpp:53
Minimal working example
#include "main.h"
void initialize() {
}
void opcontrol() {
}
Owns a set of LedStrand pointers and fans all animation commands out to each strand simultaneously.
Definition led_group.hpp:39
void rainbow(uint8_t speed)
Scroll a full HSV rainbow across the strip.
void add(LedStrand *strand)
Register a strand with this group.
void init(uint32_t refreshMs=20)
Initialize hardware on all registered strands.
void start()
Start the group refresh task.
Pattern Studio
Pattern Studio is a desktop GUI for designing and live-previewing LED profiles without flashing a brain, then exporting them as ready-to-include HitLib C++.
Download the prebuilt Windows build from the Releases page (HitLibPatternStudio-*-windows.zip), or run it from source on any platform:
git clone https://github.com/advisorylabs/hitlib.git
cd hitlib/tools/pattern_studio
pip install -e .
pattern-studio
Getting a design onto the robot
- Point Pattern Studio at your PROS project - drag the project folder onto the window, or Export > Choose PROS Project.... It looks for project.pros, and remembers the project between runs.
- Export > Deploy. The header lands in the project's include/ as hitlib_studio.hpp.
- Paste the two lines it shows you into main.cpp, once:
#include "hitlib_studio.hpp"
void initialize() { hitlib::studio::begin(); }
Deploying again overwrites that header and main.cpp does not change: begin() builds every strand from the design's port, length, refresh interval and brightness, attaches each profile and activates its first mode.
To own the wiring yourself, hitlib::studio::begin(yourGroup) puts the design's strands into your group, and #define HITLIB_STUDIO_NO_AUTOWIRE before the include leaves only the profile and the constexpr constants to build your own LedStrand from. Export > Export Current Strand as C++... (or Export All Strands as C++...) still saves through a normal file dialog for a project the app cannot see. See Profiles & Modes for the full shape of the generated file.
Building a PROS template from source
If you want to build hitlib yourself rather than using a release zip: this repo isn't set up as a pros make-managed project, so it's a plain library build followed by manual packaging.
# Clone the repo
git clone https://github.com/advisorylabs/hitlib.git
cd hitlib
# Build bin/hitlib.a requires an arm-none-eabi-gcc toolchain on PATH
# (installed alongside PROS, or via your package manager)
make
# Package it as an installable PROS template
mkdir -p template_pkg/include template_pkg/lib
cp -r include/ template_pkg/
cp bin/hitlib.a template_pkg/lib/
cp template.pros template_pkg/
cd template_pkg && zip -r ../hitlib@1.3.0.zip .
This produces hitlib@1.3.0.zip in the project root (matching the version field in template.pros), which you can then fetch with the CLI as shown above.