esp32+micropython环境
请问如何实现按键切换灯串效果啊?
一个gpio引脚做按键 一个gpio引脚做灯
几个效果的方法已经写好了
效果:按一下按键,响应一个效果,再按一下切换下一个效果如此循环。
esp32+micropython环境
请问如何实现按键切换灯串效果啊?
一个gpio引脚做按键 一个gpio引脚做灯
几个效果的方法已经写好了
效果:按一下按键,响应一个效果,再按一下切换下一个效果如此循环。
effectIndex = 0
effectTotal = 5
def keyPressed():
global effectIndex
effectIndex = (effectIndex + 1) % effectTotal
ledPlayEffect(effectIndex)
ledPlayEffect(effectIndex)