diff --git a/src/main.rs b/src/main.rs index f169e2a..1a651b6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -12,6 +12,7 @@ pub const BRIGHTNESS: u8 = 150; fn main() { let p: RawColor = [0, 0, 0, 0]; let lock = Arc::new(RwLock::new([p; LED_SIZE])); + let read = Arc::clone(&lock); thread::spawn(move || { let mut controller: Controller = ControllerBuilder::new() .channel(0, ChannelBuilder::new() @@ -24,7 +25,7 @@ fn main() { .build() .expect("Could not construct LED Controller."); loop { - let lights = lock.read().expect("Could not read array lock."); + let lights = read.read().expect("Could not read array lock."); run_lights(&mut controller, &lights).expect("Error running lights controller."); } });