Fix timing on RP2040 pio_ws2812.rs example

The example spins too fast so it doesn't appear to change;
it's delaying for microseconds instead of milliseconds.
This commit slows it down and adds a comment noting the pin
mapping for the Adafruit feather rp2040+RFM95 LoRA module,
which has its Neopixel on pin 4 instead of 16.
This commit is contained in:
Dave Andersen 2023-08-27 22:39:44 -04:00
parent 88146eb53e
commit 71c4e7e4d2

View File

@ -138,8 +138,9 @@ async fn main(_spawner: Spawner) {
const NUM_LEDS: usize = 1; const NUM_LEDS: usize = 1;
let mut data = [RGB8::default(); NUM_LEDS]; let mut data = [RGB8::default(); NUM_LEDS];
// For the thing plus, use pin 8 // Common neopixel pins:
// For the feather, use pin 16 // Thing plus: 8
// Adafruit Feather: 16; Adafruit Feather+RFM95: 4
let mut ws2812 = Ws2812::new(&mut common, sm0, p.DMA_CH0, p.PIN_16); let mut ws2812 = Ws2812::new(&mut common, sm0, p.DMA_CH0, p.PIN_16);
// Loop forever making RGB values and pushing them out to the WS2812. // Loop forever making RGB values and pushing them out to the WS2812.
@ -152,7 +153,7 @@ async fn main(_spawner: Spawner) {
} }
ws2812.write(&data).await; ws2812.write(&data).await;
Timer::after(Duration::from_micros(5)).await; Timer::after(Duration::from_millis(10)).await;
} }
} }
} }