30 lines
584 B
Rust
30 lines
584 B
Rust
pub mod util;
|
|
|
|
use util::lights::*;
|
|
use std::sync::RwLock;
|
|
use std::thread;
|
|
|
|
|
|
pub const LED_SIZE: usize = 450;
|
|
|
|
fn main() {
|
|
let lock = RwLock::new([Color {r: 0, g: 0, b: 0}; LED_SIZE]);
|
|
thread::spawn(move || loop {
|
|
let lights = lock.read().unwrap();
|
|
run_lights(&lights);
|
|
});
|
|
let mut x: u8 = 0;
|
|
loop {
|
|
if x == 255 {
|
|
x = 0;
|
|
}
|
|
let color = Color {
|
|
r: x,
|
|
g: x,
|
|
b: x
|
|
};
|
|
let mut lights = lock.write().unwrap();
|
|
lights[0] = color;
|
|
x += 1;
|
|
}
|
|
}
|