🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    How use RGB LED on M5 FIRE?

    FAQS
    2
    3
    8.4k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • P
      progga
      last edited by

      Hi,
      how can i use the RGB LED's with the new M5 FIRE. I try the Adafruit_NeoPixel library for the SK6812 but my m5 crash at start up.

      code:
      #include "esp_deep_sleep.h"

      Adafruit_NeoPixel strip = Adafruit_NeoPixel(10, 15, NEO_KHZ400);

      void setup() {
      strip.setBrightness(50);
      strip.begin();
      strip.setPixelColor(1, 255, 255, 255);
      }

      Does somebody has any idea?

      Thanks.

      F 1 Reply Last reply Reply Quote 0
      • F
        frollo555 @progga
        last edited by

        Hi,

        Try Adafruit_NeoPixel.h library. Set pin to 15(GPIO) and number pixels to 10. Enjoy.

        #include <Adafruit_NeoPixel.h>
        #include <M5Stack.h>

        #define PIN 15
        #define NUMPIXELS 10

        Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB);
        int delayval = 500;

        void setup(){

        M5.begin();
        pixels.begin();
        }

        void loop() {

        for(int i=0;i<NUMPIXELS;i++){
        // pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
        pixels.setPixelColor(i, pixels.Color(0,0,150)); // Moderately bright BLUE color.
        pixels.show(); // This sends the updated pixel color to the hardware.
        delay(delayval); // Delay for a period of time (in milliseconds).
        }
        }

        1 Reply Last reply Reply Quote 0
        • P
          progga
          last edited by

          Thank you for you help,

          now I solved the problem with esp32_digital_led_lib library.

          Example:
          [CODE]
          #include "esp32_digital_led_lib.h"

          // Enumberation ob LED's
          // 9 0
          // 8 1
          // 7 2
          // 6 3
          // 5 4

          #define LED_PORT 15

          strand_t m_sLeds = {.rmtChannel = 0, .gpioNum = 15, .ledType = LED_WS2812B_V3, .brightLimit = 32, .numPixels = 10, .pixels = nullptr, ._stateVars = nullptr};

          void Led_Init(void) {
          pinMode (LED_PORT, OUTPUT);
          digitalWrite (LED_PORT, LOW);

          if(digitalLeds_initStrands(&m_sLeds, 1)) {
              E_TRACE("Can't init LED driver()\n");
          }
          
          digitalLeds_resetPixels(&m_sLeds);
          
          // Set led 7 to red
          m_sLeds.pixels[7] = pixelFromRGBW(55, 0, 0, 0);
          
          digitalLeds_updatePixels(&m_sLeds);
          

          }

          [/CODE]

          1 Reply Last reply Reply Quote 1
          • First post
            Last post