Arduino IDE for ESP8266操作IO对应关系。

作者:lmdf | 更新时间:2016-10-19 | 浏览量:2828

简单一句话,在Arduino IDE for ESP8266里面用arduino 代码写ESP8266程序,对GPIO16的输出digitalWrite(16, LOW)就OK,前几天看到有人发的那个刷了nodemcu固件后的管脚对照表,害死人啊,我的ESP8266是刷了nodemcu固件,但是根本不能按照那个对照表操作,折腾了好几天才明白,唉!

另外发现三点:

1、GPIO6~GPIO11不要使用,否则引起存储错误,不停重启;

2、GPIO16只能做为输出,不能输入,否则也会引起错误

3、ESP的输入会保持,当某管脚连接一个开关到低电平,按下开关,ESP会输入0,当松起开关时,这个0会一直保持,直到输入高电平才会变1,然后继续保持。

也许因为新手,不知道是不是别人早就知道呢?


评论:共5条

贝壳物联 评论于:2016-10-19 22:41:12
以上说的是真的如此吗?还没遇到过,还请大神测试。
lmdf 评论于:2016-10-20 09:23:32
真的,实测结果!
贝壳物联 回复于:2016-10-20 09:55:07
回复 @lmdf:你的esp8266还有开关,是用esp8266做的开发板吧?
lmdf 回复于:2016-10-20 10:55:57
回复 @贝壳物联: 我是裸板,焊接几根线,插在面包板上
lmdf 评论于:2016-10-20 11:10:27
Digital IO
http://esp8266.github.io/Arduino/versions/2.3.0/doc/reference.html
Pin numbers in Arduino correspond directly to the ESP8266 GPIO pin numbers.pinMode, digitalRead, and digitalWrite functions work as usual, so to read GPIO2, call digitalRead(2).
Digital pins 0—15 can be INPUT, OUTPUT, or INPUT_PULLUP. Pin 16 can beINPUT, OUTPUT or INPUT_PULLDOWN_16. At startup, pins are configured asINPUT.
Pins may also serve other functions, like Serial, I2C, SPI. These functions are normally activated by the corresponding library. The diagram below shows pin mapping for the popular ESP-12 module.

Digital pins 6—11 are not shown on this diagram because they are used to connect flash memory chip on most modules. Trying to use these pins as IOs will likely cause the program to crash.
返回顶部