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-25 00:57:10 +00:00
|
|
|
use std::{thread, time};
|
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]);
|
2021-12-25 00:57:10 +00:00
|
|
|
thread::sleep(time::Duration::from_secs(1));
|
2021-12-24 23:54:53 +00:00
|
|
|
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
|
|
|
}
|