ESP8266 how to identify board in code

Hi,

Done a lot with ATmega and ATtiny's and I use this to identify the board I'm compiling for:

#if defined(__AVR_ATtiny84__) 
    //                    +--\/--+
    //               VCC 1|      |14 GND
    //   [LED] (D10) PB0 2|      |13 AREF (D0)
    //          (D9) PB1 3|      |12 PA1  (D1) [TX]->
    //         RESET PB3 4|      |11 PA2  (D2)
    //     INT0 (D8) PB2 5|      |10 PA3  (D3)
    //      PWM (D7) PA7 6|      |9  PA4  (D4) [SCL]<->
    // <->[SDA] (D6) PA6 7|      |8  PA5  (D5) PWM
    //                    +------+
    //-- PA4 = SCL (clock) PA6 = SDA (data)!
    //-- PA1 = DIL-12 = Arduino IDE D1
    //-- PB0 = DIL-2 = Arduino IDE D10

#elif defined(__AVR_ATtiny85__)
    //                    +--\/--+
    //         RESET PB5 1|      |8 VCC
    //          (D3) PB3 2|      |7 PB2 (D2) [SCL]<->
    //    [LED] (D4) PB4 3|      |6 PB1 (D1) [TX]--->
    //               GND 4|      |5 PB0 (D0) [SDA]<->
    //                    +------+
    //-- PB2 = SCL (clock) PB0 = SDA (data)!
    //-- PB1 = DIL-6 = Arduino IDE D1
    //-- PB4 = DIL-3 = Arduino IDE D4

#else
    //-- ATMega328 ----------------------
    //-- A5 = SCL (clock) A4 = SDA (data)!
    //-- PB1 = Arduino IDE D9
    //-- PB5 = Arduino IDE D13

#endif

Now I'm trying to do the same thing with ESP-boards:

// LED is needed for failure signalling
#if defined(__ESP8266_ESP01__)
    const short int BLUE_LED = 1;  //GPIO1 on ESP-01

#elif defined(__ESP8266_NODEMCU__)
    const short int BLUE_LED = 16;  //GPIO16 on NodeMCU (ESP-12)

#elif defined(__ESP8266_WEMOS_D1MINI__)
    const short int BLUE_LED = BUILTIN_LED;  

#endif

But that does not work ..

Can someone help me please?

1 Like