NECO Unit
Neco Unit 是一款独特的 RGB 灯板单元,采用可爱的猫耳造型。它经过精密设计,由 35 颗 WS2812C-2020 RGB 灯珠组成,可提供鲜艳且可自定义的灯光效果。
支持以下产品:
MicroPython 应用示例
1# SPDX-FileCopyrightText: 2024 M5Stack Technology CO LTD 2# 3# SPDX-License-Identifier: MIT 4 5import os, sys, io 6import M5 7from M5 import * 8from hardware import * 9from unit import NECOUnit 10 11 12title0 = None 13i2c0 = None 14neco_0 = None 15 16 17def setup(): 18 global title0, i2c0, neco_0 19 20 M5.begin() 21 Widgets.fillScreen(0x222222) 22 title0 = Widgets.Title( 23 "NECOUnit CoreS3 Example", 3, 0xFFFFFF, 0x0000FF, Widgets.FONTS.DejaVu18 24 ) 25 26 i2c0 = I2C(0, scl=Pin(1), sda=Pin(2), freq=100000) 27 neco_0 = NECOUnit((1, 2), 70, True) 28 neco_0.set_brightness(3) 29 30 31def loop(): 32 global title0, i2c0, neco_0 33 M5.update() 34 neco_0.set_random_color_random_led_from(0, 70) 35 36 37if __name__ == "__main__": 38 try: 39 setup() 40 while True: 41 loop() 42 except (Exception, KeyboardInterrupt) as e: 43 try: 44 from utility import print_error_msg 45 46 print_error_msg(e) 47 except ImportError: 48 print("please update to latest firmware")
UiFlow2 应用示例
class NECOUnit
Constructors
Methods
- NECOUnit.set_color_from(begin, end, rgb, per_delay)
为从起始索引到结束索引范围内的 LED 设置指定颜色。
- 参数:
UiFlow2

- NECOUnit.set_color_saturation_from(begin, end, rgb, per_delay)
为从起始索引到结束索引范围内的 LED 设置指定颜色及饱和度。
- NECOUnit.color_saturation(rgb, saturation)
调整 RGB 颜色的饱和度。
- NECOUnit.set_color_running_from(begin, end, rgb, per_delay)
为从起始索引到结束索引范围内的 LED 设置颜色,然后逐个清除它们,从而创建跑马效果。
- 参数:
UiFlow2

- NECOUnit.set_random_color_random_led_from(begin, end)
在指定范围内以随机顺序为每个 LED 设置随机颜色。
UiFlow2






