AJB2K3
Created November 27, 2019

M5StickC NeoFlashC

Using the M5StackC NeoFlashC in Micropython and UIFlow.

IntermediateProtip67
M5StickC NeoFlashC

Things used in this project

Story

Read more

Code

neoflashc.py

MicroPython
This is the base code for my NeoFlashC library.
import machine
from machine import Pin
class NeoFlashC: 
    def __init__(self, pin, number=143):
        self.port = port
        self.pin = pin [26]
        self.number = number
        self.np = machine.NeoFlashC(self.pin, self.number)
        self.np.brightness(10)

    def setColor(self, num, color_in):
        self.np.set(num, color_in)

    def setColorFrom(self, begin, end, color_in):
        begin = min(self.number, max(begin, 1))
        end = min(self.number, max(end, 1))
        for i in range(begin, end+1):
            self.np.set(i, color_in, update=False)
        self.np.show()

    def setColorAll(self, color_in):
        for i in range(1, self.number+1):
            self.np.set(i, color_in, update=False)
        self.np.show()

    def setBrightness(self, brightness):
        brightness = min(255, max(0, brightness))
        self.np.brightness(brightness)
    
    def deinit(self):
        self.np.deinit()

Test01

MicroPython
Just a simple test code that illuminates all the rgb leds white.
from m5stack import *
from m5ui import *
from uiflow import *
from neoflashc import *
From machine import Pin

setScreenColor(0x111111)
NeoFlashC.pin = (26,36)
NeoFlashC = unit.get(unit.NEOPIXEL, NeoFlashC.pin, 126)






NeoFlashC.setColorAll(0xff0000)

Credits

AJB2K3
54 projects • 35 followers
I have always had an interest in electronics but having failed my school exams, it has taken me 20+ years to produce products to share.
Contact

Comments

Please log in or sign up to comment.