NodeMCU教程 板载自带LED测试

来源:互联网 发布:简明python教程 中文 编辑:程序博客网 时间:2024/06/06 00:56
On the board of NodeMCU, there are two leds what can be tested.

1、First LED

Through the pcb file of  NodeMCU (see Figure-1 or  https://github.com/nodemcu/nodemcu-devkit-v1.0/blob/master/NODEMCU_DEVKIT_V1.0.PDF ), we can find the first led which connected by GPIO16 and VDD3V3. The index of pin is 0. (see another article of mine:《The Operation and Map of NodeMCU》). By executing the Code Block-1 can light it.

2、Second LED

By reading the circuit design schematic of ESP8266(Figure-2), we can see the led  connected by GPIO2 and VDD3 ,which's pin index is 4. Executing the Code Block-2 can light it.

—————————————————————————————————————————

上面是练英语写作的,欢迎吐槽吐舌头。中文如下:

在NodeMCU开发板上是有两个自带的LED灯供我们测试的。

1、第一个LED

通过NodeMCU的PCB电路图文件 (Figure-1 或者参考官方文档https://github.com/nodemcu/nodemcu-devkit-v1.0/blob/master/NODEMCU_DEVKIT_V1.0.PDF ),我们可以找到第一个LED,两端连接到3.3V电压和GPIO16。对照我的另一篇文章《NodeMCU GPIO操作与引脚映射》可以查到其引脚序号为0。

下图为NodeMCU部分电路原理图Figure-1:



执行下列代码即可点亮它。

Code Block-1:

[javascript] view plain copy
  1. gpio.mode(0,gpio.OUTPUT)  
  2. gpio.write(0, gpio.LOW)  

熄灭: gpio.write(0, gpio.HIGH)


2、第二个LED

查阅ESP8266的电路原理图可知,LED连接的是3.3V电压和GPIO2,对应引脚序号为4。

下图为ESP8266部分电路原理图Figure-2:



执行下列代码即可点亮它。
Code Block-2:
[javascript] view plain copy
  1. gpio.mode(4,gpio.OUTPUT)  
  2. gpio.write(4, gpio.LOW)  


熄灭: gpio.write(4, gpio.HIGH)

【转载请注明出处:http://blog.csdn.net/leytton/article/details/51650082

原创粉丝点击