I got some "NodeMCU V3" similar to this: https://www.aliexpress.com/item/New-Wireless-module-CH340-NodeMcu-V3-Lua-WIFI-Internet-of-Things-development-board-based-ESP8266/32683073762.html

I have arduino ide 1.8.5, I see nodemcuv1, nodemcuv2 in the board list. I normaly use nodemcuv2.

I don't see explicitly a V3. For 99% of my needs this is not a problem. But LED_BUILTIN doesn't work as expected. Is there any boards.txt or something I should update to get it to work?

I know that there is a different pinout here: Does the Node MCU v3 (LoLin) not have a builtin led? and that the logic is reversed. I can turn on the LED_BUILTIN if I do digitalWrite(D4,LOW) will turn led on, but my question is:

can I have something defined at the level of boards.txt or similar that allows me to say something like:

digitalWrite(LED_BUILTIN, LED_ON)

and it will work with both nodemcuv2 and nodemcuv3 depending on the board I choose in the dropdown list...? since I have a mixed batch of boths and I want to have the same code base.

  • I got marked as duplicated, but I think is not the case. I know how to turn on the LED
    – nicocesar
    Apr 5 '18 at 17:29
  • 1
    Just use const int MY_LED_PIN = D4; OR #define MY_LED_PIN D4 in your sketch?
    – gre_gor
    Apr 5 '18 at 19:28
  • I solved my problem by having 2 codebases, so nodemcuv2 and nodemcuv3 have different CODE. I was wondering if this can be done when I select the board, so all my code remains the same.
    – nicocesar
    Apr 16 '18 at 16:45