Crates.io | blinksy |
lib.rs | blinksy |
version | 0.8.0 |
created_at | 2025-05-01 09:31:23.739604+00 |
updated_at | 2025-08-26 10:45:07.70627+00 |
description | no-std, no-alloc LED control library designed for 1D, 2D, and 3D layouts |
homepage | https://github.com/ahdinosaur/blinksy |
repository | https://github.com/ahdinosaur/blinksy |
max_upload_size | |
id | 1656056 |
size | 179,496 |
layout
in 1D, 2D, or 3D spacepattern
(effect), or choose from our built-in patterns
library
driver
to send each frame of colors to your LEDs, using our built-in drivers
library.If you want help to support a new chipset, make an issue!
If you want help to port a pattern from FastLED / WLED to Rust, make an issue!
If you want help to support a new target, make an issue!
blinksy
: blinksy-desktop
: blinksy-esp
: gledopto
: To quickstart a project, see:
To start using the library, see control.
For all examples, see:
./blinksy-desktop/examples
./esp/gledopto/examples
https://github.com/user-attachments/assets/36a2c6ad-7ae6-4498-85b3-ed76d0b62264
#![no_std]
#![no_main]
use blinksy::{
layout::{Layout3d, Shape3d, Vec3},
layout3d,
patterns::noise::{noise_fns, Noise3d, NoiseParams},
ControlBuilder,
};
use gledopto::{board, bootloader, elapsed, main, ws2812};
bootloader!();
#[main]
fn main() -> ! {
let p = board!();
layout3d!(
Layout,
[
// bottom face
Shape3d::Grid {
start: Vec3::new(1., -1., 1.), // right bottom front
horizontal_end: Vec3::new(-1., -1., 1.), // left bottom front
vertical_end: Vec3::new(1., -1., -1.), // right bottom back
horizontal_pixel_count: 16,
vertical_pixel_count: 16,
serpentine: true,
},
// back face
Shape3d::Grid {
start: Vec3::new(-1., -1., -1.), // left bottom back
horizontal_end: Vec3::new(-1., 1., -1.), // left top back
vertical_end: Vec3::new(1., -1., -1.), // right bottom back
horizontal_pixel_count: 16,
vertical_pixel_count: 16,
serpentine: true,
},
// right face
Shape3d::Grid {
start: Vec3::new(1., 1., -1.), // right top back
horizontal_end: Vec3::new(1., 1., 1.), // right top front
vertical_end: Vec3::new(1., -1., -1.), // right bottom back
horizontal_pixel_count: 16,
vertical_pixel_count: 16,
serpentine: true,
},
// front face
Shape3d::Grid {
start: Vec3::new(-1., -1., 1.), // left bottom front
horizontal_end: Vec3::new(1., -1., 1.), // right bottom front
vertical_end: Vec3::new(-1., 1., 1.), // left top front
horizontal_pixel_count: 16,
vertical_pixel_count: 16,
serpentine: true,
},
// left face
Shape3d::Grid {
start: Vec3::new(-1., 1., -1.), // left top back
horizontal_end: Vec3::new(-1., -1., -1.), // left bottom back
vertical_end: Vec3::new(-1., 1., 1.), // left top front
horizontal_pixel_count: 16,
vertical_pixel_count: 16,
serpentine: true,
},
// top face
Shape3d::Grid {
start: Vec3::new(1., 1., 1.), // right top front
horizontal_end: Vec3::new(1., 1., -1.), // right top back
vertical_end: Vec3::new(-1., 1., 1.), // left top front
horizontal_pixel_count: 16,
vertical_pixel_count: 16,
serpentine: true,
}
]
);
let mut control = ControlBuilder::new_3d()
.with_layout::<Layout>()
.with_pattern::<Noise3d<noise_fns::Perlin>>(NoiseParams {
..Default::default()
})
.with_driver(ws2812!(p, Layout::PIXEL_COUNT))
.build();
control.set_brightness(0.2);
loop {
let elapsed_in_ms = elapsed().as_millis();
control.tick(elapsed_in_ms).unwrap();
}
}
https://github.com/user-attachments/assets/22f388d0-189e-44bd-acbf-186a142b956d
use blinksy::{
layout::{Shape2d, Vec2},
layout2d,
patterns::noise::{noise_fns, Noise2d, NoiseParams},
ControlBuilder,
};
use blinksy_desktop::{
driver::{Desktop, DesktopError},
time::elapsed_in_ms,
};
use std::{thread::sleep, time::Duration};
fn main() {
layout2d!(
Layout,
[Shape2d::Grid {
start: Vec2::new(-1., -1.),
horizontal_end: Vec2::new(1., -1.),
vertical_end: Vec2::new(-1., 1.),
horizontal_pixel_count: 16,
vertical_pixel_count: 16,
serpentine: true,
}]
);
let mut control = ControlBuilder::new_2d()
.with_layout::<Layout>()
.with_pattern::<Noise2d<noise_fns::Perlin>>(NoiseParams {
..Default::default()
})
.with_driver(Desktop::new_2d::<Layout>())
.build();
loop {
if let Err(DesktopError::WindowClosed) = control.tick(elapsed_in_ms()) {
break;
}
sleep(Duration::from_millis(16));
}
}
https://github.com/user-attachments/assets/1c1cf3a2-f65c-4152-b444-29834ac749ee
#![no_std]
#![no_main]
use blinksy::{
layout::{Shape2d, Vec2},
layout2d,
patterns::noise::{noise_fns, Noise2d, NoiseParams},
ControlBuilder,
};
use gledopto::{board, bootloader, elapsed, main, ws2812};
bootloader!();
#[main]
fn main() -> ! {
let p = board!();
layout2d!(
Layout,
[Shape2d::Grid {
start: Vec2::new(-1., -1.),
horizontal_end: Vec2::new(1., -1.),
vertical_end: Vec2::new(-1., 1.),
horizontal_pixel_count: 16,
vertical_pixel_count: 16,
serpentine: true,
}]
);
let mut control = ControlBuilder::new_2d()
.with_layout::<Layout>()
.with_pattern::<Noise2d<noise_fns::Perlin>>(NoiseParams {
..Default::default()
})
.with_driver(apa102!(p))
.build();
control.set_brightness(0.1);
loop {
let elapsed_in_ms = elapsed().as_millis();
control.tick(elapsed_in_ms).unwrap();
}
}
https://github.com/user-attachments/assets/703fe31d-e7ca-4e08-ae2b-7829c0d4d52e
#![no_std]
#![no_main]
use blinksy::{
layout::Layout1d,
layout1d,
patterns::rainbow::{Rainbow, RainbowParams},
ControlBuilder,
};
use gledopto::{board, bootloader, elapsed, main, ws2812};
bootloader!();
#[main]
fn main() -> ! {
let p = board!();
layout1d!(Layout, 60 * 5);
let mut control = ControlBuilder::new_1d()
.with_layout::<Layout>()
.with_pattern::<Rainbow>(RainbowParams {
..Default::default()
})
.with_driver(ws2812!(p, Layout::PIXEL_COUNT))
.build();
control.set_brightness(0.2);
loop {
let elapsed_in_ms = elapsed().as_millis();
control.tick(elapsed_in_ms).unwrap();
}
}
Contributions are welcome! Please see CONTRIBUTING.md for details.
If you want to help, the best thing to do is use Blinksy for your own LED project, and share about your adventures.
Blinksy is licensed under the European Union Public License (EUPL).
You are free to use, modify, and share Blinksy freely. Whether for personal projects, art installations, or commercial products.
Only once you start distributing something based on changes to Blinksy, you must share any improvements back with the community by releasing your source code.
Unlike more viral copyleft licenses, you will not be required to release the source code for your entire project, only changes to Blinksy.