Tell me what you want, What you really, really want.

Moderator: Mmiscool

User avatar
By Venkatesh
#33754 NodeMCU LUA script pin mapping is different from Arduino ESP mapping.

You need to refer the "D?" (see your posted picture) in the lua for the corresponding GPIO.

Eg. so PIN 4 -> GPIO 2

-Venkatesh
User avatar
By forlotto
#33801 Yes I understood the comment I could look a pin map up online for arduino then map that to the GPIO or I could simply toggle on and off and figure out which is which and just make a note. I will do one or the other ... Just figured I wasn't the first to the races I'll get it all mapped out no worries. Thanks for your reply though really appreciate it.

According to IGRR ...

igrr commented on Jul 22

NodeMCU has weird pin mapping.
Pin numbers written on the board itself do not correspond to ESP8266 GPIO pin numbers. We have constants defined to make using this board easier:

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;

These are defined here.

If you want to use NodeMCU pin 5, use D5 for pin number, and it will be translated to 'real' GPIO pin 14.



So IGRR is saying you can use pin D5 and it will be auto mapped to GPIO 14 more or less I dunno if this is the same story with basic this was basically the reasoning I was asking for associations or mappings I guess...

Source: https://github.com/esp8266/Arduino/issues/584

But as I said no worries I will figure it out in time.
Last edited by forlotto on Thu Nov 12, 2015 5:25 pm, edited 1 time in total.
User avatar
By Mmiscool
#33802 The pins boxed in orange are the numbers you will use in the basic interpreter.

Also by the way. Got your package today. Thank you. This is going to make it easier to test things out.
You do not have the required permissions to view the files attached to this post.