Neopixels - IO pins don't seem to be cooperating

Posted on
  • Hi all,
    I'm really new to the ESP32 world and hardware programming in general. I have a problem I'm not sure where to begin to diagnose. I can't seem to get my IO pin to listen.

    My set up looks pretty similar to the following:

    Except instead of the Huzzah board I have a DevKitC board (this was the closest thing I could find for Fritzing) and I'm actually connecting the data out from the DevKitC board on IO14. Additionally, for now I'm just powering the board via USB (so remove the voltage regulator section from the mix).

    My script to power just two leds is pretty simple:

    const neopixel = require('neopixel');
    var strip = new Uint8ClampedArray([
      0x0, 0x0, 0xff,
      0x0, 0x0, 0x0,
    neopixel.write(D14, strip);

    Sometimes it doesn't react when I upload this. Or if it does, it's seemingly at random. On consecutive uploads, different leds will light up as different colors. Just on a whim, I tried to move the data lead to other IO pins and those seem to have different colors that light up which I wasn't expecting. One other weird thing I noticed, is if I try a script like this:

    var rgb = new Uint8ClampedArray(2*3);
    var pos = 0;
    function getPattern() {
      for (var i=0;i<rgb.length;) {
        rgb[i++] = (1 + Math.sin((i+pos)*0.1324)) * 127;
        rgb[i++] = (1 + Math.sin((i+pos)*0.1654)) * 127;
        rgb[i++] = (1 + Math.sin((i+pos)*0.1)) * 127;
      return rgb;
    setInterval(function() {
      require("neopixel").write(D14, getPattern());
    }, 100);

    This actually does seem to flash lots of colors. So it's getting some input somehow.

    Any help on this is much appreciated. I'm not even sure how to start diagnosing the issue.

    1 Attachment

    • Screen Shot 2017-09-15 at 9.44.55 PM.png
  • Woke up this morning and almost immediately noticed that I had forgotten to ground the level shifter. D'oh.

    This is working perfectly now! It's very fun to play with.

  • Nice - thanks for letting us know - and for posting the code/pictures. They're amazingly helpful!

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview

Neopixels - IO pins don't seem to be cooperating

Posted by Avatar for phil303 @phil303