use smart_leds::hsv::{hsv2rgb, Hsv};
use smart_leds::SmartLedsWrite;
use std::thread::sleep;
use std::time::Duration;
use ws2812_esp32_rmt_driver::Ws2812Esp32Rmt;
fn main() {
// It is necessary to call this function once. Otherwise some patches to the runtime
// implemented by esp-idf-sys might not link properly. See https://github.com/esp-rs/esp-idf-template/issues/71
esp_idf_svc::sys::link_patches();
// Bind the log crate to the ESP Logging facilities
esp_idf_svc::log::EspLogger::initialize_default();
let mut ws2812 = Ws2812Esp32Rmt::new(0, 8).unwrap();
log::info!("Start NeoPixel rainbow!");
let mut hue: u8 = 0;
loop {
let pixels = std::iter::repeat(hsv2rgb(Hsv {
hue,
sat: 255,
val: 8,
}))
.take(25);
log::info!("Setting pixels: {:?}", pixels);
ws2812.write(pixels).unwrap();
sleep(Duration::from_millis(100));
hue = hue.wrapping_add(10);
}
}
Loading
esp32-c6-devkitc-1
esp32-c6-devkitc-1