• Hi,

    Is this currently working? I'm trying to drive a single WS2811s (in particular this circuit: https://hackaday.io/project/4603-pixiflo­od).

    I've tried using the hardware SPI implementation on the ESP8266 too but I've had no joy with that either. The LED works fine on my Espruino Pico using hardware SPI so I know that's fine.

    My environment is:
    NodeMCU
    Espruino v81.780
    12V circuit running the LED, 3.3V in the NodeMCU, common ground

    Here's the code I've been using:

    var esp = require("ESP8266");
    var pin = new Pin(15);        // I've tried all available GPIOs
    esp.neopixelWrite(pin, [50, 50, 50]);
    

    Any help would be really appreciated as I'd like to use this for a demo of some of my research on Wednesday.

    Thanks!

  • Try the following:

    var esp = require("ESP8266");
    var pin = new Pin(15);        // I've tried all available GPIOs
    pinMode(pin, "output");
    esp.neopixelWrite(pin, [50, 50, 50]);
    

    It may be that setting the pinMode explicitly to output is required.

  • Unfortunately that hasn't helped. I managed to get SPI1 working occasionally but only by putting a number as padding at the start of the array, but that still only seems to work some of the time.

    SPI1.setup({baud:3200000});
    var r = 25;
    var g = 25;
    var b = 25;
    SPI1.send4bit([10, r, g, b], 0b0001, 0b0011);
    

    Edit: with more testing it seems almost random what colour comes out compared to the array that gets sent.

    Edit 2: The hardware SPI seems to give a different output even if I send the same command several times, it looks like a timing problem to me, but that's a guess from playing around with the baud rate. It looks like software SPI is the only option for me at the moment.

    Edit 3: This works, but don't ask me why. The timeout and the leading 0 in the array are essential for it to reliably output the correct colour.

    SPI1.setup({baud:3200000});
    setTimeout(function(){
      SPI1.send4bit([0,10,10,10], 0b0001, 0b0011);
    },100);
    
About

Avatar for Kolban @Kolban started