Rainbow!
This commit is contained in:
parent
ee48d96a02
commit
429c8e1c57
1 changed files with 22 additions and 8 deletions
|
@ -17,16 +17,30 @@ use lights_hal::{boot, delay, entry};
|
||||||
fn main() -> ! {
|
fn main() -> ! {
|
||||||
let mut lights = GammaCorrector(boot());
|
let mut lights = GammaCorrector(boot());
|
||||||
|
|
||||||
let mut red = Wrapping(0u8);
|
let mut t = Wrapping(0u8);
|
||||||
loop {
|
loop {
|
||||||
red += Wrapping(1);
|
t += Wrapping(1);
|
||||||
|
|
||||||
let start = Rgb(red.0, 0, 0);
|
let red = Rgb(150, 0, 0);
|
||||||
let end = Rgb(0, 100, 100u8.saturating_sub(red.0));
|
let yellow = Rgb(150, 150, 0);
|
||||||
|
let green = Rgb(0, 150, 0);
|
||||||
|
let teal = Rgb(0, 75, 150);
|
||||||
|
let purple = Rgb(75, 0, 150);
|
||||||
|
|
||||||
(0..20u8).map(
|
(0..16u8).map(
|
||||||
|x| blend(start, end, gray(x.saturating_mul(15)))
|
|x| blend(red, yellow, gray(x * 16))
|
||||||
).render_to(&mut lights);
|
).chain((0..16u8).map(
|
||||||
delay(500_000);
|
|x| blend(yellow, green, gray(x * 16))
|
||||||
|
)).chain((0..16u8).map(
|
||||||
|
|x| blend(green, teal, gray(x * 16))
|
||||||
|
)).chain((0..16u8).map(
|
||||||
|
|x| blend(teal, purple, gray(x * 16))
|
||||||
|
)).chain((0..16u8).map(
|
||||||
|
|x| blend(purple, red, gray(x * 16))
|
||||||
|
))
|
||||||
|
.cycle().skip(t.0 as usize).take(20)
|
||||||
|
.render_to(&mut lights);
|
||||||
|
|
||||||
|
delay(1_000_000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue