Hi, i am using NodeMCU 1.0 (ESP-12E Module) board. i connect a temperature sensor to digital pin 4
digitalRead(4);
then i change connection from digital4 to digital 7 pin. So the code. but it didn't work. after 1hour of investigate, i change my code "7" to "D7".
digitalRead(D4);
surprisingly it work. my question is
1-why did it happen?
2-which pin i use just numbers and which pin with "D" latter? thank you
Look at the following layout for the pin signatures of NodeMCU (ESp8266).
1. Refer to above diagram. you can write the following codes:
int y = digitalRead(D4); //Digital Pin Number 4
or
int y = digitalRead(2); //GPIO2 = General Purpose IO Pin Number 2
2. You can do the following:
int y = digitalRead(D7);
or
int y = digitalRead(13);
1 Like
now i get it. thank you so much. is it same in arduino uno?
No. The numbers on the UNO (and Nano, and Mega) board match the Arduino pin numbers.
NodeMCU and some other ESP8266 boards chose to label the pins sequentially with D0 through Dwhatever and map those names to the GPIO numbers which are not sequential.
2 Likes
system
Closed
October 7, 2022, 10:59pm
6
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.