-->
Page 1 of 1

Variable type for 8266 pins?

PostPosted: Thu Jul 20, 2017 7:07 pm
by themrmurray
So, Arduino pins can be defined by an int variable, but what variable type would I use for the Dx notation of the 8266 in Arduino IDE?

Ex:
int pin = 14;
vs.
??? pin = D7;

Obviously I could just use the Arduino pin numbers, but for convenience it would be nice to use 8266 notation.

Re: Variable type for 8266 pins?

PostPosted: Thu Jul 20, 2017 8:14 pm
by rudy
I compile with the Generic ESP8266 module selection. When setting up the pin I use the GPIO number of the pin.

Code: Select allconst int voltPin = A0;       //  Only analog pin
const int ledPin =  15;       //  LED pin on GPIO15
const int relayPin = 4;       //  LED pin on GPIO4


If you define your board as a different type, NodeMCU for example, then a Dx number scheme is available. Renumbering port pins so that pins on the board are in sequence.

Image

Re: Variable type for 8266 pins?

PostPosted: Sun Aug 06, 2017 2:38 pm
by ark02
Pin type is
Code: Select allstatic const uint8_t


See igrr's post here: https://github.com/esp8266/Arduino/issues/584