How use RGB LED on M5 FIRE?



  • 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.



  • 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).
    }
    }



  • 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]


登录后回复
 

与 M5Stack Community 的连接断开,我们正在尝试重连,请耐心等待