Chat about current Lua tools and IDEs

User avatar
By Ralphxyz
#19278 Is there anyway in LUA to use the pin names from the Development Kit v2?
Like D0, D1, D2 instead of using 0 (GPIO16 D0), 1 (GPIO5 D1) 2 (GPIO4 D2)?

Could I map them with gpio = {[D0]=0,[D1=1,[D2]=2}

Do I have to? Seems stupid to not be able to use the labels.
User avatar
By GerryKeely
#19637 Hi

There is an example in the NodeMCU API showing how to achieve this

Code: Select all gpio = {[0]=3,[1]=10,[2]=4,[3]=9,[4]=1,[5]=2,[10]=12,[12]=6,[14]=5,[15]=8,[16]=0}

      pin = gpio[2] -- connect the signal wire to pin 4


Gerry