Skip to content

Custom pattern

Psycho edited this page Jan 11, 2020 · 3 revisions

If you want to create your own patterns, you can easily edit /ledPatterns/CustomLedPattern.py and start HLC by adding the argument --pattern=custom

If you are really proud of your pattern and think the world should be using it, well, contact me and we'll see to make it available by default :)

Making a custom led pattern is not that hard. You can check how the Alexa/Google/Kiboost patterns are made. The 'projectalice' pattern makes extensive use of the predefined animations and is a good start to learn how to use the premade animations very easily. One important thing is to never call a superclass function directly from the pattern file!

This is forbidden:

self.setLed([0, 0, 0, 0])

This is what you should do:

self._controller.setLed([0, 0, 0, 0])

A led pattern basically is an image we display. Imagine your leds being pixels. First you setLed() according to what you want. Once it's set, you display that image with self._controller.show() that will actually light on/off the leds as you've set them