@bob1996w said in Unexpected behavior on M5stack fire LEDs:

Hello, I have just got my M5stack fire and is making a simple LED modifying program with M5ez. I use the same library as samples in arduino IDE, Adafuit_NeoPixel. The program compiles with no errors, but when I start to use, the LEDs behave wierd.

Here are the revalent code.

#define M5_NEO_NUM 10 #define M5_NEO_PIN 15 Adafruit_NeoPixel pixels = Adafruit_NeoPixel(M5_NEO_NUM, M5_NEO_PIN); void setup() { #include <themes/default.h> #include <themes/dark.h> ezt::setDebug(INFO); pixels.begin(); pixels.setBrightness(255); pixels.show(); ez.begin(); }

Selecing which LED to control...

void mainmenu_leds() { ezMenu submenu("Set LED colors"); submenu.txtSmall(); submenu.buttons("up # Back # Select # # down #"); for(int i = 0; i < 10; ++ i) { submenu.addItem("LED#" + (String)i); } submenu.upOnFirst("last|up"); submenu.downOnLast("first|down"); while (submenu.runOnce()) { int pickedItem = (int)submenu.pick() - 1; if (pickedItem >= 0 && pickedItem < 10) { menu_setLED(pickedItem); } } }

Each LED gets individual control options here. (0 <= led_no <= 9)

void menu_setLED(int led_no) { /* ez.msgBox("Set LED#" + (String)led_no, "You have picked LED#" + (String)led_no); */ ezMenu submenu("Set LED#" + (String)led_no); submenu.txtSmall(); submenu.buttons("up # Back # Select # # down #"); //submenu.addItem("R | R\t0"); //submenu.addItem("G | G\t0"); //submenu.addItem("B | B\t0"); submenu.addItem("black | Turn off"); submenu.addItem("white | Turn bright"); while(submenu.runOnce()) { if (submenu.pickName() == "black") { pixels.setPixelColor(led_no, pixels.Color(0, 0, 0)); pixels.show(); delay(20); } else if (submenu.pickName() == "white") { pixels.setPixelColor(led_no, pixels.Color(255, 255, 255)); pixels.show(); delay(20); } } }

Expected behavior:
When "black" is picked, the corresponding LED should be turned off (pixels.Color(0,0,0))
When "white" is picked, the LED should turn white (pixels.Color(255,255,255))

What really happens:
Usually the corresponding LED behaves normally, but the other LED may also light up random color due to unknown reasons.
Also, when set LED#0 to black, it displays green. That means LED#0 cannot be turned off now.

I really don't know what is happening here, please help. Thanks in advance.

The Neopixel code uses WS2812 leds where as the Go based used on the fire uses SK6812 leds which operate differently.