NECO Unit
The Neco Unit is a unique RGB light board unit that features an adorable cat ear shape. It is designed with precision and comprises 35 WS2812C-2020 RGB lamp beads, providing vibrant and customizable lighting effects.
Support the following products:
Micropython Example:
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 Example:
class NECOUnit
Constructors
- class NECOUnit(port, number, active_low)
Initialize the NECOUnit with a specific port, LED count, and active low configuration for the button.
- Parameters:
port (tuple) – A tuple containing the port information, where the first element is for the button and the second is for the WS2812 LEDs.
number (int) – The number of LEDs in the WS2812 strip. Default is 70.
active_low (bool) – Boolean flag indicating whether the button is active low. Default is True.
UIFLOW2:
Methods
- NECOUnit.set_color_from(begin, end, rgb, per_delay)
Set the color for a range of LEDs from the begin index to the end index with a specified color.
- Parameters:
UIFLOW2:
- NECOUnit.set_color_saturation_from(begin, end, rgb, per_delay)
Set the color saturation for a range of LEDs from the begin index to the end index with a specified color and saturation.
- NECOUnit.color_saturation(rgb, saturation)
Adjust the color saturation of an RGB color.
- NECOUnit.set_color_running_from(begin, end, rgb, per_delay)
Set the color for a range of LEDs from the begin index to the end index, then clear them one by one, creating a running effect.
- Parameters:
UIFLOW2:
- NECOUnit.set_random_color_random_led_from(begin, end)
Set a random color to each LED in a random order within the specified range.
UIFLOW2:
- NECOUnit.fill(v)
Fill the entire NECOUnit strip with the specified color.
- Parameters:
v (int) – A tuple containing the RGB (or RGBW) values to fill the strip with.
- NECOUnit.set_color(i, c)
Set the color of the LED at the specified index.
- Parameters:
i – The index of the LED to set.
c (int) – The color value to set the LED to (in RGB or RGBW format).
UIFLOW2: