# RGB:from fpioa_manager import *from Maix import GPIOimport time# 注册芯片的外设和引脚的对应关系fm.register(board_info.LED_R, fm.fpioa.GPIO1) # REDfm.register(board_info.LED_G, fm.fpioa.GPIO2) # GREENfm.register(board_info.LED_B, fm.fpioa.GPIO3) # BLUE# 定义 GPIO 对象led_r=GPIO(GPIO.GPIO1,GPIO.OUT)led_g=GPIO(GPIO.GPIO2,GPIO.OUT)led_b=GPIO(GPIO.GPIO3,GPIO.OUT)# 创建 RGB 元组RGB = (led_r, led_g, led_b)value = 0# 主循环while True:# 遍历 RGBfor led in RGB:led.value(value)time.sleep_ms(200)# 取反 IO 输出value = ~value
参考:MaixPy