Hmm nada with ES8266 NodeMCU

Using IDE 0.26.1 on 64 bit Windows 10
I selected NodeMCU 1.0 (ESP-12E) as my board
I tried the sample LED node, set the port to D1, set LUM = 1
It compiles, downloads without any error. NodeMCU led blinks during download as expected.

led

but, the LED connected to D1 does not go on.
LED works, if I touch the wire that is connected to D1 to 3V3 it goes on.

Nothing appears in the Serial monitor from the Arduino IDE.
Plain Arduino sketches run fine.

I wondered if D1 is being correctly mapped to GPIO 5 (ESP8266 GPIO 5 = D1)
I tried to get a read out of the value of a port D1, but can find no port-to-string node.

I attached a string constant-string node to a watch node, but I can’t work out how to observe a run time value, tried debug mode which opens a new tab in the IDE with a stop button, but I must be missing something… because I see nothing debug-like at all…

Double clicking on a watch node suggests it comprises an input pin and a “not implemented” node.

So how can we confirm that D1 = 5 ? Looked in the generated code but could not find it, but given that it could be constructed in different ways, I added a constant-string = “Fred”, but I cant find Fred in the generated code either. - This suggests to me that the project designed on screen in wholly unrelated to whatever code is being generated for me.

Bottom line is: I don’t seem to be able to get anything to work at all.

Hi, try it pins_arduino.h

 #define LED_BUILTIN 16

static const uint8_t D0   = 16;
static const uint8_t D1   = 5;
static const uint8_t D2   = 4;
static const uint8_t D3   = 0;
static const uint8_t D4   = 2;
static const uint8_t D5   = 14;
static const uint8_t D6   = 12;
static const uint8_t D7   = 13;
static const uint8_t D8   = 15;
static const uint8_t D9   = 3;
static const uint8_t D10  = 1;

If you want to use D1, use D5
If you want to use D2, use D4

1 Like

yup indeed, D5 does work for D1. I did suspect the classic port mapping issue but I was so intent on finding out what the value of D1 was, I did not think of simply trying D5 for D1.

I was fully expecting the defines for D0 - Dn to be properly mapped based on the board selected. OK

So if we can’t use direct pin numbers in the UI, can we get a number-to-port node?

Input pin - number
Output pin - port

  • I’ll put that into a separate post so it can be categorized

That’s right, for LED_BUILTIN (D0) you have to use D16

1 Like