<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Unexpected behavior on M5stack fire LEDs]]></title><description><![CDATA[<p dir="auto">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, <code>Adafuit_NeoPixel</code>. The program compiles with no errors, but when I start to use, the LEDs behave wierd.</p>
<p dir="auto">Here are the revalent code.</p>
<pre><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 &lt;themes/default.h&gt;
  #include &lt;themes/dark.h&gt;
  ezt::setDebug(INFO);
  pixels.begin();
  pixels.setBrightness(255);
  pixels.show();
  ez.begin();
}
</code></pre>
<p dir="auto">Selecing which LED to control...</p>
<pre><code>void mainmenu_leds() {
  ezMenu submenu("Set LED colors");
  submenu.txtSmall();
  submenu.buttons("up # Back # Select # # down #");
  for(int i = 0; i &lt; 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 &gt;= 0 &amp;&amp; pickedItem &lt; 10) {
      menu_setLED(pickedItem);
    }
  }
}
</code></pre>
<p dir="auto">Each LED gets individual control options here. (0 &lt;= <code>led_no</code> &lt;= 9)</p>
<pre><code>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);
    }
  }
}
</code></pre>
<p dir="auto">Expected behavior:<br />
When "black" is picked, the corresponding LED should be turned off  (pixels.Color(0,0,0))<br />
When "white" is picked, the LED should turn white (pixels.Color(255,255,255))</p>
<p dir="auto">What really happens:<br />
Usually the corresponding LED behaves normally, but the other LED may also light up random color due to unknown reasons.<br />
Also, when set LED#0 to black, it displays green. That means LED#0 cannot be turned off now.</p>
<p dir="auto">I really don't know what is happening here, please help. Thanks in advance.</p>
]]></description><link>https://community.m5stack.com/topic/665/unexpected-behavior-on-m5stack-fire-leds</link><generator>RSS for Node</generator><lastBuildDate>Thu, 12 Mar 2026 01:19:59 GMT</lastBuildDate><atom:link href="https://community.m5stack.com/topic/665.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 14 Feb 2019 02:22:50 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Unexpected behavior on M5stack fire LEDs on Tue, 25 Feb 2020 18:08:20 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://community.m5stack.com/uid/1154">@bob1996w</a> I meet the same problem, I think I can answer your last question about RGB. I found code on M5Stack_NeoPixelTest.ino</p>
<pre><code>#define M5STACK_FIRE_NEO_NUM_LEDS 10
#define M5STACK_FIRE_NEO_DATA_PIN 15

Adafruit_NeoPixel pixels = Adafruit_NeoPixel(M5STACK_FIRE_NEO_NUM_LEDS, M5STACK_FIRE_NEO_DATA_PIN, NEO_GRB + NEO_KHZ800);
</code></pre>
<p dir="auto">NEO_GRB was the data stream order flag according to the comment. GRB &amp; RGB orders different!</p>
<p dir="auto">There were similar flags for FastLED, working code shows below</p>
<pre><code>FastLED.addLeds&lt;WS2812B, M5STACK_FIRE_NEO_DATA_PIN, GRB&gt;

</code></pre>
]]></description><link>https://community.m5stack.com/post/7569</link><guid isPermaLink="true">https://community.m5stack.com/post/7569</guid><dc:creator><![CDATA[horsley]]></dc:creator><pubDate>Tue, 25 Feb 2020 18:08:20 GMT</pubDate></item><item><title><![CDATA[Reply to Unexpected behavior on M5stack fire LEDs on Thu, 14 Feb 2019 17:49:40 GMT]]></title><description><![CDATA[<p dir="auto">Thanks for the replies! The FastLED works with no "ghost LEDs", but I still have some questions:<br />
When changing <code>leds[some_led_index].r</code>, it actually changes the green value of the led. <code>leds[some_led_index].g</code> changes red. blue works normally. Is there anyone having same problems? Thanks.</p>
<p dir="auto">This is the current settings I'm using:</p>
<pre><code>#define M5_NEO_NUM 10
#define M5_NEO_PIN 15
CRGB leds[M5_NEO_NUM];
void setup()
  FastLED.addLeds&lt;SK6812, M5_NEO_PIN&gt;(leds, M5_NEO_NUM);
  // other setups...
}
</code></pre>
<p dir="auto">Compiler complains that <code>No hardware SPI pins defined.  All SPI access will default to bitbanged output</code>, so I also tried <code>WS2811</code>, but the same problem continues.</p>
<p dir="auto">The revelant code:</p>
<pre><code>
void setLedSingleChannelValue(int led_no, String channel, int val) {
  Serial.println("led_no " + (String)led_no + ", channel " + channel + ", val " + (String)val);
  if (channel == "R") {
    if (led_no &lt; 10) {
      leds[led_no].red = val;
    }
    else {
      if (led_no == 10 || led_no == 11) {
        for (int i = 0; i &lt; 5; ++ i) {
          leds[i].red = val;
        }
      }
      if (led_no == 10 || led_no == 12) {
        for (int i = 5; i &lt; 10; ++ i){
          leds[i].red = val;
        }
      }
    }
  }
  else if (channel == "G") {
    if (led_no &lt; 10) {
      leds[led_no].g = val;
    }
    else {
      if (led_no == 10 || led_no == 11) {
        for (int i = 0; i &lt; 5; ++ i) {
          leds[i].g = val;
        }
      }
      if (led_no == 10 || led_no == 12) {
        for (int i = 5; i &lt; 10; ++ i){
          leds[i].g = val;
        }
      }
    }
  }
  else if (channel == "B") {
    if (led_no &lt; 10) {
      leds[led_no].b = val;
    }
    else {
      if (led_no == 10 || led_no == 11) {
        for (int i = 0; i &lt; 5; ++ i) {
          leds[i].b = val;
        }
      }
      if (led_no == 10 || led_no == 12) {
        for (int i = 5; i &lt; 10; ++ i){
          leds[i].b = val;
        }
      }
    }
  }
  FastLED.show();
  delay(5);
}

void checkAndSetLedSingleChannel(int led_no, String channel, int delta) {
  int check_led_no = (led_no &lt; 10) ? led_no : (led_no == 12) ? 9 : 0;
  int currentValue = getLedSingleChannelValue(check_led_no, channel);
  int afterValue = currentValue + delta;
  afterValue = (afterValue &lt; 0) ? 0 : (afterValue &gt; 255) ? 255 : afterValue;
  setLedSingleChannelValue(led_no, channel, afterValue);
}

void menu_setLedSingleChannel(int led_no, String channel) {
  ezMenu submenu(getLedHeaderText(led_no, "Set"));
  submenu.txtSmall();
  submenu.buttons("-1 # -10 # Back | OK # # +1 # +10 # -50 # +50 # ");
  submenu.addItem(channel + " | " + channel + "\t" + (String)getLedSingleChannelValue(led_no, channel));
  while(submenu.runOnce()) {
    String pickButton = submenu.pickButton();
    if (pickButton == "-1") {
      checkAndSetLedSingleChannel(led_no, channel, -1);
    }
    else if (pickButton == "+1") {
      checkAndSetLedSingleChannel(led_no, channel, 1);
    }
    else if (pickButton == "-10") {
      checkAndSetLedSingleChannel(led_no, channel, -10);
    }
    else if (pickButton == "+10") {
      checkAndSetLedSingleChannel(led_no, channel, 10);
    }
    else if (pickButton == "-50") {
      checkAndSetLedSingleChannel(led_no, channel, -50);
    }
    else if (pickButton == "+50") {
      checkAndSetLedSingleChannel(led_no, channel, 50);
    }
    submenu.setCaption(channel, channel + "\t" + (String)getLedSingleChannelValue(led_no, channel));
    delay(20);
  }
}

// The program enters from this function.
void menu_setLed(int led_no) {
  /*
  ez.msgBox("Set LED#" + (String)led_no, 
    "You have picked LED#" + (String)led_no);
  */
  ezMenu submenu(getLedHeaderText(led_no, "Set"));
  submenu.txtSmall();
  submenu.buttons("up # Back # Select # # down #");
  submenu.addItem("R | R\t" + (String)getLedSingleChannelValue(led_no, "R"));
  submenu.addItem("G | G\t" + (String)getLedSingleChannelValue(led_no, "G"));
  submenu.addItem("B | B\t" + (String)getLedSingleChannelValue(led_no, "B"));
  while(submenu.runOnce()) {
    String picked = submenu.pickName();
    if (picked == "black") {
    if (picked == "R" | picked == "G" || picked == "B") {
      menu_setLedSingleChannel(led_no, picked);
    }
    delay(20);
  }
}
</code></pre>
]]></description><link>https://community.m5stack.com/post/3024</link><guid isPermaLink="true">https://community.m5stack.com/post/3024</guid><dc:creator><![CDATA[bob1996w]]></dc:creator><pubDate>Thu, 14 Feb 2019 17:49:40 GMT</pubDate></item><item><title><![CDATA[Reply to Unexpected behavior on M5stack fire LEDs on Thu, 14 Feb 2019 07:08:26 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://community.m5stack.com/uid/1154">@bob1996w</a> said in <a href="/post/3006">Unexpected behavior on M5stack fire LEDs</a>:</p>
<blockquote>
<p dir="auto">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, <code>Adafuit_NeoPixel</code>. The program compiles with no errors, but when I start to use, the LEDs behave wierd.</p>
<p dir="auto">Here are the revalent code.</p>
<pre><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 &lt;themes/default.h&gt;
  #include &lt;themes/dark.h&gt;
  ezt::setDebug(INFO);
  pixels.begin();
  pixels.setBrightness(255);
  pixels.show();
  ez.begin();
}
</code></pre>
<p dir="auto">Selecing which LED to control...</p>
<pre><code>void mainmenu_leds() {
  ezMenu submenu("Set LED colors");
  submenu.txtSmall();
  submenu.buttons("up # Back # Select # # down #");
  for(int i = 0; i &lt; 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 &gt;= 0 &amp;&amp; pickedItem &lt; 10) {
      menu_setLED(pickedItem);
    }
  }
}
</code></pre>
<p dir="auto">Each LED gets individual control options here. (0 &lt;= <code>led_no</code> &lt;= 9)</p>
<pre><code>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);
    }
  }
}
</code></pre>
<p dir="auto">Expected behavior:<br />
When "black" is picked, the corresponding LED should be turned off  (pixels.Color(0,0,0))<br />
When "white" is picked, the LED should turn white (pixels.Color(255,255,255))</p>
<p dir="auto">What really happens:<br />
Usually the corresponding LED behaves normally, but the other LED may also light up random color due to unknown reasons.<br />
Also, when set LED#0 to black, it displays green. That means LED#0 cannot be turned off now.</p>
<p dir="auto">I really don't know what is happening here, please help. Thanks in advance.</p>
</blockquote>
<p dir="auto">The Neopixel code uses WS2812 leds where as the Go based used on the fire uses SK6812 leds which operate differently.</p>
]]></description><link>https://community.m5stack.com/post/3018</link><guid isPermaLink="true">https://community.m5stack.com/post/3018</guid><dc:creator><![CDATA[ajb2k3]]></dc:creator><pubDate>Thu, 14 Feb 2019 07:08:26 GMT</pubDate></item><item><title><![CDATA[Reply to Unexpected behavior on M5stack fire LEDs on Thu, 14 Feb 2019 05:59:51 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://community.m5stack.com/uid/1154">@bob1996w</a><br />
Please use FastLED Library for controlling RGB Led instead of Adafuit_NeoPixel Library.</p>
<p dir="auto"><a href="https://github.com/FastLED/FastLED" target="_blank" rel="noopener noreferrer nofollow ugc">https://github.com/FastLED/FastLED</a></p>
<p dir="auto">Because controlling RGB Led with Adafuit_NeoPixel Library will cause some unexpected bug, like some leds will turn into unexpected status(on or blink).</p>
]]></description><link>https://community.m5stack.com/post/3015</link><guid isPermaLink="true">https://community.m5stack.com/post/3015</guid><dc:creator><![CDATA[m5-docs]]></dc:creator><pubDate>Thu, 14 Feb 2019 05:59:51 GMT</pubDate></item></channel></rss>