-->
Page 1 of 2

I/O pin names bug

PostPosted: Fri Oct 21, 2016 3:22 pm
by Luc Volders
So I found this small bug.
Maybe it has already been adressed but I just stumbled upon it.

[EDIT]
This bug occurs when programming the NodeMCU. I have not (yet) tested it on the WEMOS D1 (and mini D1)

Normally to put an I/O pin in the HIGH status I use:

Code: Select allio(po,D1,1)

This works for D0 to D7.
However for D8 till D10 this does not work.
So the code:

Code: Select allio(po,D10,1)

Does not work.

There is a workaround and that is to adress the pin names different:

Code: Select allio(po,15,1)  ' use this for D8
io(po,3,1) ' use this for D9
io(po,1,1) ' use this for D10

This way you can adress all 10 I/O pins.

It would however be nice if we could use the names D0 to D10 for using all 11 I/O pins.

Luc

Re: I/O pin names bug

PostPosted: Fri Oct 21, 2016 4:30 pm
by Mmiscool
internally to esp basic the following table is used to convert the d numbers to the real pin numbers

Note that you can use the RX and TX pin designations.

Also note that on all the pictures of the boards d9 and d8 are never used. Only rx and tx.

Code: Select all  if (Name == F("D0")) { *value = 16; return PARSER_TRUE;}
  if (Name == F("D1")) { *value =  5; return PARSER_TRUE;}
  if (Name == F("D2")) { *value =  4; return PARSER_TRUE;}
  if (Name == F("D3")) { *value =  0; return PARSER_TRUE;}
  if (Name == F("D4")) { *value =  2; return PARSER_TRUE;}
  if (Name == F("D5")) { *value = 14; return PARSER_TRUE;}
  if (Name == F("D6")) { *value = 12; return PARSER_TRUE;}
  if (Name == F("D7")) { *value = 13; return PARSER_TRUE;}
  if (Name == F("D8")) { *value = 15; return PARSER_TRUE;}
  if (Name == F("RX")) { *value =  3; return PARSER_TRUE;}
  if (Name == F("TX")) { *value =  1; return PARSER_TRUE;}




se5DU8HFRNx8gC9IapULg5Q.png
d1-mini-esp8266-board-sh_fixled.jpg

Re: I/O pin names bug

PostPosted: Sun Oct 23, 2016 8:36 am
by Luc Volders
Thanks (again) Mike !!!
I can live with this. I could not find any reference in the manual though.
Maybe something to put in the - Language Reference -

However I am using this pinout schematic:

Image

and that clearly states D8, D9 and D10

Luc

Re: I/O pin names bug

PostPosted: Tue Oct 25, 2016 3:40 am
by livetv
It would not be hard to translate D9 and D10 too if enough people think that is a good idea.

As for the D8 failure? What alpha version are you using? Early in branch 3 I found a typo that could cause D8 to resolve to GPIO13 and not GPIO15. What I did not know at the time is that this translation is done in two places within ESPbasic (the latter being the most commonly used). This HAS been fixed but if your version isn't too up-to-date, you may still see that bug.

To check for this, change D8 and see if GPIO13 changes. If so, check your alpha version.