leds/src/util/lights.rs

16 lines
461 B
Rust
Raw Normal View History

2021-12-24 18:29:57 +00:00
use rs_ws281x::RawColor;
2021-12-24 23:54:53 +00:00
use rs_ws281x::Controller;
use rs_ws281x::WS2811Error;
2021-12-23 19:34:26 +00:00
2021-12-01 01:27:28 +00:00
pub fn run_lights(controller: &mut Controller, values: &[RawColor; crate::LED_SIZE]) -> Result<(), WS2811Error> {
2021-12-24 23:54:53 +00:00
// println!("Value: {:?}", strip[0]);
let channels: Vec<usize> = controller.channels();
let mut strip = controller.leds_mut(channels[0]);
2021-12-01 01:27:28 +00:00
for i in 0..strip.len() {
2021-12-24 23:54:53 +00:00
strip[i] = values[i];
}
controller.render();
controller.wait()
2021-12-01 01:27:28 +00:00
}