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};
|
||||
|
||||
const ORANGE: Rgb = Rgb(255,150,0);
|
||||
const PURPLE: Rgb = Rgb(200,0,255);
|
||||
|
||||
const BUFFER_LEN: usize = 300;
|
||||
|
||||
#[entry]
|
||||
fn main() -> ! {
|
||||
let mut lights = boot();
|
||||
lights.heartbeat();
|
||||
|
||||
let front_pattern = [
|
||||
PURPLE,
|
||||
PURPLE,
|
||||
ORANGE,
|
||||
PURPLE,
|
||||
PURPLE,
|
||||
].iter().cycle();
|
||||
let back_pattern = repeat(&ORANGE);
|
||||
|
||||
let pattern =
|
||||
repeat(&Rgb(255,0,255)).take(150)
|
||||
back_pattern.take(150)
|
||||
.chain(
|
||||
repeat(&Rgb(255,128,0)).take(150)
|
||||
front_pattern.take(150)
|
||||
).cycle();
|
||||
|
||||
let mut buffer = [HardwareRgb(255,255,0); 200];
|
||||
let mut buffer = [HardwareRgb(255,255,0); BUFFER_LEN];
|
||||
loop {
|
||||
// blink light to demonstrate loop is still running
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ const GREEN: Rgb = Rgb(100, 255, 0);
|
|||
const PURPLE: Rgb = Rgb(196, 0, 255);
|
||||
|
||||
const SEGMENT_LEN: usize = 50;
|
||||
const BUFFER_LEN: usize = 200;
|
||||
const BUFFER_LEN: usize = 300;
|
||||
|
||||
#[entry]
|
||||
fn main() -> ! {
|
||||
|
|
Loading…
Reference in a new issue