Overview

The gridmas tree project is loosely based off of Matt Parker (standup math)'s 500LED christmas tree

The Gridmas tree will have 1000 LEDs individually addressable in 3 dimensional space which will be setup in GRID at Herio-Watt university

Some of the main advantages over Matt's implementation is that a whole frame work has been written to abstract the nitty gritty away and leave the programmer only to worry about their patter/animation. The gridmas tree also runs in real time. Unlike the harvard implementation which prerenders patterns which kind of ruins the fun of it. this also improves the ability to tear down and change trees, as well as sharing different patters. Every pattern can run on every tree. A backend graphics pipeline has been writen to ensure that every pattern runs at the same speed, no mattern if its running on the simulator or on a physical tree.

Getting Started

Downloading

To download the Gridmas tree code you can either use the github Desktop app to clone the code or use git from the terminal

git clone https://github.com/COOK1EK1W1/gridmas-tree.git

Open the downloaded folder in your code editor of choice.

Setup

Before we run any of the code, we need to install our modules, setting up a virtual environment is optional but I' cover it anyway, I'll also assume you already have python > 10 installed

Virtual Environment:

From the gridmas-tree folder run:

python -m venv venv

Then for windows:

venv/Scripts/activate.bat

or mac or linux:

source venv/bin/activate
Install Modules:

Install the modules with pip, (if you get errors saying pip couldn't be found, make sure it's in the PATH variables on windows)

pip install -r requirements.txt
Running

Now that we have the modules seutp, we are ready to run the tree, make sure you're in the backend directory

cd backend

Then run the main script

python main.py

the program should then start up including the web server and the simulator, assuming you don't have 1000 LEDs connected

Changing Patterns

you should now be able to go to http://localhost:3000 which should be hosting the web interface

you can click any of the patterns listed and they should be played on the tree

Writing Your Own Patterns

patterns are stored in the patterns directory within backend, you can open these up to see how they work

new patterns can be added to the same folder just be sure to include the following to your pattern

1 2 3 4 5 name = "My Excelent Pattern" author = "Ciaran" def run(): # my code goes here

These are the only requirements for a pattern, the name is displayed on the web interface along with the author name

The run function is the main function which is called when you click the button on the web interface

I encorage you to look at other patterns to see how they work as well as techniques used, also check out the sections on the left to see the API for each module