• Thank you both for your prompt responses to this non-official board.
    Hope everyone is having good holidays.

    Pin mapping was the first issue I got to when getting this Wemos D1 (r1) board.
    So I created my own object to store the mapping to my board :

    const WemosD1 = {
      D0: 3,
      D1: 1,
      D2: 16,
      D3: 5,
      D4: 4,
      D5: 14,
      D6: 12,
      D7: 13,
      D8: 0,
      D9: 2,
      D10: 15,
      D11: 13,
      D12: 12,
      D13: 14,
      D14: 4,
      D15: 5
    };
    

    Simple numbers representing the GPIOXX equivalent from the ESP8266. D pins overlap each other (ie. D5 & D13 are GPIO14).
    This object was built using the silkscreen on the board itself. I have not tested every one of them yet. I will probably get around to it tonight.

    My SPI setup looks likes this : (GPIO equivalents in comments)

      SPI1.setup({
        sck: WemosD1.D5, // GPIO14
        miso: WemosD1.D6, // GPIO12
        mosi: WemosD1.D7 // GPIO13
      });
      
      // And then the MFRC522 
      const rfid = require('MFRC522').connect(SPI1, WemosD1.D2); //CS -> GPIO16 (also tried GPIO15)
    

    When comparing the GPIO pins to a pinout image or a bare ESP8266, it looks like it fits with the pins labeled MISO, MOSI and SCLK. GPIO15 being labeled as CS, it gives an error 15 instead of 16.

    I will have more time tonight to go through the jswrap C file.

    "I also solved this using a logic analyzer [...] around twenty dollars."

    Wow I didn't know something like this existed, at such a low cost. I must get one now.

    I will receive a NodeMCU V3 in a week or two, that should be the actual module that I will be implementing in my system. Hopefully the NodeMCU.XX pin mapping will work with this one.

    Professionally, I'm a front-end developer. I LOVE Javascript. I LOVE how Espruino implements it on microcontrollers. My javascript sketch is indeed about half the size the C one for the same tasks, and it feels much more elegant. Although for this time it might be more effort than C, I'm looking forward to the challenge.

    So tonight's jobs :

    • Verify my pin mapping object
    • Go through the jswrap C file that @MaBe linked to confirm pin mapping
    • Read on SPI communication (need more understanding) and try to confirm SPI communication is working.
    • Shopping for a logic analyzer

    EDIT: Formatting correction 2019-12-30

About

Avatar for Drumline18 @Drumline18 started