控制蓝色LED灯

板子线路图:https://doc.itprojects.cn/0006.zhishi.esp32/01.download/esp32_Schematic Prints.pdf
Micropython ESP32 开发文档:http://docs.micropython.org/en/latest/esp32/quickref.html
控制蓝色呼吸灯就是控制输入的高低电频,对应的输入针脚是2,当输入高电频的时候灯就会亮,输入低电频的时候因为led的两边都是低电频所以就会灭(1=高,0=低)

import machine import time pin2 = machine.Pin(2, machine.Pin.OUT) while True: pin2.value(1) time.sleep(1) pin2.value(0) time.sleep(1)
参考地址:https://doc.itprojects.cn/0006.zhishi.esp32/02.doc/index.html#/02.led