Random LED color on pushing a button

✅ Modify the code so the RGB LED light changes to different random color upon each button press. The LED should not go out or change color if the button is not pressed for some time.

Continue by adding to your previous solution or the code from advanced/button-interrupt/src/main.rs You can find the solution for this exercise in advanced/button-interrupt/examples/solution_led.rs

Solving Help

  • The necessary imports are already made, if you enter cargo --doc --open you will get helping documentation regarding the LED.
  • The LED's part number is WS2812RMT.
  • It's a programmable RGB LED. This means there aren't single pins to set for red, green and blue, but that we need to instantiate it to be able to send RGB8 type values to it with a method.
  • The board has a hardware random number generator. It can be called with esp_random().
  • Calling functions from the esp-idf-sys is unsafe in Rust terms and requires an unsafe() block. You can assume that these functions are safe to use, so no other measures are required.