add heartbeat led to july 4

This commit is contained in:
Tangent Wantwight 2021-07-06 00:19:42 -04:00
parent 3cb7fc1a57
commit 6cc39d3a9b
1 changed files with 21 additions and 21 deletions

View File

@ -15,28 +15,28 @@ const FULL_PORCH: usize = 150;
#[allow(dead_code)]
#[inline(always)]
pub fn run(lights: &mut impl Lights<Pixel = HardwareRgb>) -> ! {
let stars = [BLUE, WHITE, BLUE]
.iter()
.cycle()
.take(FULL_PORCH)
.cloned();
let stripes = repeat(RED)
.take(11)
.chain(repeat(WHITE).take(11))
.cycle()
.take(11 * 12)
.chain(repeat(RED).take(11))
.chain(repeat(OFF))
.take(FULL_PORCH);
let pattern = Harrogate {
porch_back: stripes,
porch_front: stars,
};
let mut heartbeat = false;
loop {
pattern.clone().render_to(lights);
heartbeat = !heartbeat;
delay(1_000_000);
let stars = [BLUE, WHITE, BLUE].iter().cycle().take(FULL_PORCH).cloned();
let stripes = repeat(RED)
.take(11)
.chain(repeat(WHITE).take(11))
.cycle()
.take(11 * 12)
.chain(repeat(RED).take(11))
.chain(repeat(OFF).take(6))
.chain(repeat(if heartbeat { RED } else { OFF }))
.take(FULL_PORCH);
let pattern = Harrogate {
porch_back: stripes,
porch_front: stars,
};
pattern.render_to(lights);
delay(24_000_000);
}
}