Revise Halloween pattern
This commit is contained in:
parent
5a741d870b
commit
5cb3c49ed8
2 changed files with 19 additions and 5 deletions
|
@ -12,23 +12,37 @@ use lights::{
|
||||||
};
|
};
|
||||||
use lights_hal::{boot, delay, entry};
|
use lights_hal::{boot, delay, entry};
|
||||||
|
|
||||||
|
const ORANGE: Rgb = Rgb(255,150,0);
|
||||||
|
const PURPLE: Rgb = Rgb(200,0,255);
|
||||||
|
|
||||||
|
const BUFFER_LEN: usize = 300;
|
||||||
|
|
||||||
#[entry]
|
#[entry]
|
||||||
fn main() -> ! {
|
fn main() -> ! {
|
||||||
let mut lights = boot();
|
let mut lights = boot();
|
||||||
lights.heartbeat();
|
lights.heartbeat();
|
||||||
|
|
||||||
|
let front_pattern = [
|
||||||
|
PURPLE,
|
||||||
|
PURPLE,
|
||||||
|
ORANGE,
|
||||||
|
PURPLE,
|
||||||
|
PURPLE,
|
||||||
|
].iter().cycle();
|
||||||
|
let back_pattern = repeat(&ORANGE);
|
||||||
|
|
||||||
let pattern =
|
let pattern =
|
||||||
repeat(&Rgb(255,0,255)).take(150)
|
back_pattern.take(150)
|
||||||
.chain(
|
.chain(
|
||||||
repeat(&Rgb(255,128,0)).take(150)
|
front_pattern.take(150)
|
||||||
).cycle();
|
).cycle();
|
||||||
|
|
||||||
let mut buffer = [HardwareRgb(255,255,0); 200];
|
let mut buffer = [HardwareRgb(255,255,0); BUFFER_LEN];
|
||||||
loop {
|
loop {
|
||||||
// blink light to demonstrate loop is still running
|
// blink light to demonstrate loop is still running
|
||||||
lights.heartbeat();
|
lights.heartbeat();
|
||||||
|
|
||||||
for (i, pixel) in pattern.clone().take(200).enumerate() {
|
for (i, pixel) in pattern.clone().take(BUFFER_LEN).enumerate() {
|
||||||
buffer[i] = correct(pixel);
|
buffer[i] = correct(pixel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ const GREEN: Rgb = Rgb(100, 255, 0);
|
||||||
const PURPLE: Rgb = Rgb(196, 0, 255);
|
const PURPLE: Rgb = Rgb(196, 0, 255);
|
||||||
|
|
||||||
const SEGMENT_LEN: usize = 50;
|
const SEGMENT_LEN: usize = 50;
|
||||||
const BUFFER_LEN: usize = 200;
|
const BUFFER_LEN: usize = 300;
|
||||||
|
|
||||||
#[entry]
|
#[entry]
|
||||||
fn main() -> ! {
|
fn main() -> ! {
|
||||||
|
|
Loading…
Reference in a new issue