# Rust Embassy Help

**URL:** <https://users.rust-lang.org/t/rust-embassy-help/111938>\
**Category:** embedded\
**Created:** [May 24, 2024, 4:18pm UTC](https://users.rust-lang.org/t/rust-embassy-help/111938 "2024-05-24T16:18:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![catalici](https://avatars.discourse-cdn.com/v4/letter/c/919ad9/32.png) [@catalici](https://users.rust-lang.org/u/catalici)\
**Post date:** [May 24, 2024, 4:18pm UTC](https://users.rust-lang.org/t/rust-embassy-help/111938/1 "2024-05-24T16:18:38Z")

</div>

Hello! I am really new to Rust, especially in Embedded Rust with the Embassy framework. I have a project for university where I am building WS2812B led strip and a sound sensor. I tried all the crates I found, but nothing worked, especially for the LED strip. I was able to write the code I in MicroPython, but I want to use Rust. I am really desperate and I'd really need some help.

I am using a PICO W as a hardware.

Thank you for your attention!

The code:

```from
from neopixel import Neopixel
import time

pix = Neopixel(8, 0, 0, "GRB")
mic = Pin(1, machine.Pin.IN, machine.Pin.PULL_DOWN)

c = 0

color_dict = {0:(255, 100, 0),
              1:(255,50,0),
              2:(0, 255, 0),
              3:(0,0,255),
              4:(255, 0, 0),
              5:(0, 255, 100),
              6:(255, 255,255)}

while True: 
    print(mic.value())
    if mic.value() == 1:
        pix.brightness(255)
        pix.fill(color_dict[0])    
        pix.show()
    else:
        pix.brightness(255)
        pix.fill((0,0,0))    
        pix.show()

```

---

<div class="post-metadata">

**Author:** ![jofas](https://sea1.discourse-cdn.com/flex019/user_avatar/users.rust-lang.org/jofas/32/30690_2.png) [@jofas](https://users.rust-lang.org/u/jofas)\
**Post date:** [May 24, 2024, 4:22pm UTC](https://users.rust-lang.org/t/rust-embassy-help/111938/2 "2024-05-24T16:22:55Z")

</div>

Hi, and welcome to URLO! It would be highly appreciated if you could format your code instead of posting it as plain text, which makes it hard to read. You can find guidance on how to do so here:

> [@Forum Code Formatting and Syntax Highlighting](https://users.rust-lang.org/t/forum-code-formatting-and-syntax-highlighting/42214):
>
> To format code in this forum you need to surround the code with three backticks (```). For example, typing this... ``` fn main() { println!() } ``` ...will be rendered as highlighted Rust code, like so: fn main() { println!() } You can also tell the forum software which language you're using by adding the language after the opening backticks. ```cpp #include \<iostream\> int main() { std::cout \<\< "Hello World!"; } ``` Will appear with highlighting as: #include \<iostream\> int main(…

---

<div class="post-metadata">

**Author:** ![parasyte](https://sea1.discourse-cdn.com/flex019/user_avatar/users.rust-lang.org/parasyte/32/24763_2.png) [@parasyte](https://users.rust-lang.org/u/parasyte)\
**Post date:** [May 24, 2024, 6:44pm UTC](https://users.rust-lang.org/t/rust-embassy-help/111938/3 "2024-05-24T18:44:37Z")

</div>

There is an example for driving the ws2812 on a Pico here: [embassy/examples/rp/src/bin/pio\_ws2812.rs at main · embassy-rs/embassy (github.com)](https://github.com/embassy-rs/embassy/blob/main/examples/rp/src/bin/pio_ws2812.rs)

Is that what you are looking for?

---

<div class="post-metadata">

**Author:** ![system](https://sea1.discourse-cdn.com/flex019/user_avatar/users.rust-lang.org/system/32/51372_2.png) [@system](https://users.rust-lang.org/u/system)\
**Post date:** [August 22, 2024, 6:44pm UTC](https://users.rust-lang.org/t/rust-embassy-help/111938/4 "2024-08-22T18:44:51Z")

</div>

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.
