This application:
D2   = 4;   // DHT DATA I/O
D3   = 0;	 // BUTTON - most modules have it populated on PCB
D4   = 2;   // LED (RELAY) - most modules have it populated, on ESP32 is with reversed logic levels



Pinout ESP12 (8266)
D	GPIO 	In	Out 	Notes

D0	16	 no interrupt	no PWM or I2C support	HIGH at boot used to wake up from deep sleep
D1	5	 OK	OK	often used as SCL (I2C)
D2	4	 OK	OK	often used as SDA (I2C)
D3	0	 PU OK	pulled up connected to FLASH button, boot fails if pulled LOW
D4	2	 PU	OK	pulled up HIGH at boot connected to on-board LED, boot fails if pulled LOW
D5	14	 OK	OK	SPI (SCLK)
D6	12	 OK	OK	SPI (MISO)
D7	13	 OK	OK	SPI (MOSI)
D8	15	 pulled to GND	OK	SPI (CS) Boot fails if pulled HIGH
RX	3	 OK	RX pin	HIGH at boot
TX	1	 TX pin	OK	HIGH at boot debug output at boot, boot fails if pulled LOW
A0	ADC0	Analog Input 


Pinout ESP32
IO  	In	Out	Notes

0	PU	OK	pulled-up input, outputs PWM signal at boot
1	TX  	OK	debug output at boot
2	OK	OK	connected to on-board LED
3	OK	RX 	HIGH at boot
4	OK	OK	
5	OK	OK	outputs PWM signal at boot

6-11 	x	 x	connected to the integrated SPI flash

12	OK	OK	boot fail if pulled high
13	OK	OK	
14	OK	OK	outputs PWM signal at boot
15	OK	OK	outputs PWM signal at boot
16	OK	OK	
17	OK	OK	
18	OK	OK	
19	OK	OK	
21	OK	OK	
22	OK	OK	
23	OK	OK	
25	OK	OK	
26	OK	OK	
27	OK	OK	
32	OK	OK	
33	OK	OK	
34	OK		input only
35	OK		input only
36	OK		input only
39	OK		input only