aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorDave Andersen <[email protected]>2023-08-27 22:39:44 -0400
committerDave Andersen <[email protected]>2023-08-27 22:39:44 -0400
commit71c4e7e4d22a2f3e8c77ffb4b0a4b01198239bcf (patch)
tree3f4ea92315f3e3fe9481e471ef388bc372b2b331 /examples
parent88146eb53e40ea2ab43c2db77f3f62c6d08c9b36 (diff)
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.
Diffstat (limited to 'examples')
-rw-r--r--examples/rp/src/bin/pio_ws2812.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/examples/rp/src/bin/pio_ws2812.rs b/examples/rp/src/bin/pio_ws2812.rs
index bc87016ec..5c0c60246 100644
--- a/examples/rp/src/bin/pio_ws2812.rs
+++ b/examples/rp/src/bin/pio_ws2812.rs
@@ -138,8 +138,9 @@ async fn main(_spawner: Spawner) {
138 const NUM_LEDS: usize = 1; 138 const NUM_LEDS: usize = 1;
139 let mut data = [RGB8::default(); NUM_LEDS]; 139 let mut data = [RGB8::default(); NUM_LEDS];
140 140
141 // For the thing plus, use pin 8 141 // Common neopixel pins:
142 // For the feather, use pin 16 142 // Thing plus: 8
143 // Adafruit Feather: 16; Adafruit Feather+RFM95: 4
143 let mut ws2812 = Ws2812::new(&mut common, sm0, p.DMA_CH0, p.PIN_16); 144 let mut ws2812 = Ws2812::new(&mut common, sm0, p.DMA_CH0, p.PIN_16);
144 145
145 // Loop forever making RGB values and pushing them out to the WS2812. 146 // Loop forever making RGB values and pushing them out to the WS2812.
@@ -152,7 +153,7 @@ async fn main(_spawner: Spawner) {
152 } 153 }
153 ws2812.write(&data).await; 154 ws2812.write(&data).await;
154 155
155 Timer::after(Duration::from_micros(5)).await; 156 Timer::after(Duration::from_millis(10)).await;
156 } 157 }
157 } 158 }
158} 159}