User Documentation
This is the main hub for anyone taking part in the 2025 GRIDmas Tree project.
Please Note
The closing date for pattern submissions for the 2025 competition is: 14/12/2025
Please make sure you have submitted your pattern before this date
For your first pattern, you can use this code Taken From This Example:
| Example - On | |
|---|---|
From here you can build your own pattern.
Pattern Requirements
For a pattern to be valid, it must do have at miminum, these two lines of code:
from gridmas import *- This imports all the important things from the Gridmas module. Allowing you to manipulate the treedef draw(): pass- Obviously replacingpasswith the code you want to use to make the tree do things. This method is how your pattern is run by the pattern manager.
Warning
If you took part in the competition last year, please not that the way your pattern is run has changed. Your pattern no longer has control over the tree. The tree has control over your pattern.
An example of this is shown below. It is the simplest pattern, it simply turns on all LEDs on the tree to a random color.
Draw function
The rendering pipeline has been heavily optimised to allow for complex patterns with lots of shapes.
The standard frame rate is 45fps (~22ms) which is a balance between the limitations of the Raspberry pi and looking smooth on the tree. To achieve this your pattern file's draw() function is called ever 22ms.
Once the draw() function finishes, the tree is drawn to automatically. However this causes some complications, variables must be declared as global to persist between calls
Alternatively you can use the yield syntax. Yielding pauses the execution of your pattern and allows gridmas to draw the tree.
Note
you can use the yield from syntax to allow yielding from other functions, this must be bubbled down to the draw function
Rendering pipeline
The renderer follows a simple checklist for every pixel to decide its color:
- has the pixel been directly set.
pixel(n).set_color(Color.red()) - Do any of the shapes contain this pixel.
Sphere(...)orLine(...) - Is there a background color.
background(Color.red()) - Leave the pixel the same as the last frame
This means Shapes are drawn on top of the background, and directly setting colors is drawn on top of shapes.
Within each layer a function can be called several times, ie. setting the same pixel to several different colors will take the last color: