• Mon 2021.09.06 - Posted 01:44pm CST - ties in with another post I'm working on

    Edit:   Flash new version 2V10 results in infinite loop

    Likely to be responded to by @MaBe

    https://github.com/espruino/Espruino/blo­b/master/boards/ESP8266_4MB.py



    I had a working ESP8266 circa 2017 that used the old neopixel module that was included as a separate .js file. That .js module is no longer available, and during the transition, I hadn't made a copy of that file.

    I noticed that Neopixel is now included in the current build, so I re-flashed a current version.

    http://www.espruino.com/ESP8266_Flashing­

    This did not go well, (see the other post I'm working on) so I located the 2V00 version mentioned here:

    http://www.espruino.com/EspruinoESP8266#­saving-code-to-flash

    >process.env
    ={
      VERSION: "2v00",
      GIT_COMMIT: "ff35517",
      BOARD: "ESP8266_4MB",
      FLASH: 0, RAM: 81920,
      MODULES: "Flash,Storage,hea" ... "r,crypto,neopixel",
    



    This line of code no longer works: (am uploading from R-Hand editor side of WebIDE)

    require("neopixel").write(D2, [0,0,63, 55,77,0, 55,0,77]);
    

    The API Reference indicates this is now deprecated:

    https://www.espruino.com/Reference#l_ESP­8266_neopixelWrite

    'This function is deprecated. Please use require("neopixel").write(pin, data) instead'

    so the format of the code line appears accurate, also confirming with:

    http://www.espruino.com/Reference#neopix­el



    Referencing:

    https://github.com/espruino/Espruino/blo­b/master/targets/esp8266/jswrap_nodemcu.­c

    Conventions for digitalWrite() now suggest NodeMCU.D2 but that doesn't work either.

    require("neopixel").write(NodeMCU.D2, [0,0,63, 55,77,0, 55,0,77]);
    



    Some quick checking shows that there really hasn't been any activity for over 18 months using Neopixels on ESP8266.

    At the moment, seeking a sanity check on the pin value for ESP8266. Currently running on a D1 mini.

  • please post a picture of your board wired to the neopixel

  • Tue 2021.09.07

    I'm not understanding how an image of the hardware is going to answer my initial request for the ASCII value that is to be entered into a Javascript statement.

    require("neopixel").write(pin, [0,0,63, 55,77,0, 55,0,77]);
    

    What should the value of 'pin' be for the ESP8266?



    The hardware is sound as I've used an Arduino flashed ESP8266. Will double/triple check yet again later this week. I've also posted several examples in the forums with working Espruino Javascript on Pico, WiFi and Pixl.

    For the ESP8266, the data wire is connected to silkscreened text 'D2' which is four pins over from the 5V input pin.

    We know from the data sheets that D2 is GPIO4 and shares SDA of the I2C bus. I've removed the module that worked using I2C, so I can confirm that D2 is SDA on this board.

    We also know that Espruino has a naming convention of an alpha char followed by a numeral. But that doesn't work for ESP32 or ESP8266.


    So to fill in the pin value for Neopixels, should it be:

    a) NodeMCU.D2
    b) D2
    c) 4             // GPIO4 which is D2
    d) D4
    e) other pin as SDA on the I2C bus may not be used as a general GPIO pin



          or, restating the request . . .

    Does someone have a working ESP8266 example that can share the pin value used in code and the printed pin silkscreen designator please.

  • Just load 2V09 on a AI ESP12 board and tested successfully neopixel.

  • Wed 2021.09.08

    'Just load 2V09 on a AI ESP12 board and tested successfully neopixel.'

    require("neopixel").write(pin,data);
    

    What argument value was used for the 'pin' parameter above?

    With that, I'll map the ESP12 to my D1 mini.

  • Sat 2021.09.11

    Solved! On an ESP8266 Wavgat D1 Mini using GPIO4 silkscreened D2 use the argument NodeMCU.D2


    require("neopixel").write(NodeMCU.D2, [55,55,55]);
    



    May be entered on L-Hand console side of WebIDE also.

  • Sun 2021.09.12

    Weired anomaly with pin mode and NodeMCU board references.

    Checking against:

    https://github.com/espruino/Espruino/blo­b/master/targets/esp8266/jswrap_nodemcu.­c

    >const PIN = NodeMCU.D7;
    
    >pinMode(PIN, "output", false);
    
    
    >getPinMode(NodeMCU.D7)
    ="output"
    >
    
    
    // anomaly: Espruino returns the GPIO port prefixed by 'D' which is not the silkscreened pin value
    
    
    >PIN
    
    =D13
    >
    
    // expected 'D7'
    
    
    > dump()
    > pinMode(D13, "output");
    >
    
    
  • NodeMCU is just a convenience mapping to actual GPIO in the ESP8266. So NodeMCU.D7 is actually D13 as it states. So it looks perfectly normal.

  • What should the value of 'pin' be for the ESP8266?

    Also almost any free pin on a generic ESP8266 board can be used for Neopixels typcally. Just choose the most convenient one.

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

Sanity Check for Neopixel pin Require statement running on ESP8266 D1 Mini [SOLVED post #6]

Posted by Avatar for Robin @Robin

Actions