-
Notifications
You must be signed in to change notification settings - Fork 56
Projects
A Project stores all the information about a BiblioPixel project in a text file in JSON format. This is used to create a library of BiblioPixel projects to access at will.
{
"driver": {
"typename": "simpixel",
"num": 12
},
"layout": "strip"
"animation": {
"typename": "bibliopixel.animation.tests.StripChannelTest"
},
"run": {
"max_steps": 5
},
"path": "/development/BiblioPixelAnimations"
}
A project is a JSON object with many named sections. Most of them you won't have to fill in until you need to do something fancy.
-
driver
: identifies the hardware driving the LED and its characteristics -
layout
: represents the geometric layout of the LEDs in one or more drivers -
animation
: the function that animates the LEDs over time -
run
: a collection time settings for the animation -
path
: a list of directories to add to the PYTHONPATH -
numbers
: whether and how to use fast numpy arithmetic -
aliases
: a dictionary of aliases, shorthands to avoid repetitive typing -
dimensions
: the layout of your LEDs in 1, 2 or 3 dimensions
On this page, we're only going to look at the first four sections, JSON objects named
driver
, layout
, animation
, and run
- the rest are described in ProjectSections.
The driver
, layout
and animation
sections describe how to create the
BiblioPixel Driver
, Layout
or Animation
object for your project.
Each of these has the special typename
entry: the name of the actual type
of object that's being constructed.
The remaining entries correspond to the arguments to the constructor for that type.
The run
section's entries are used to call the run()
method on the
Animation
.
So the example above corresponds to the following old-style code:
driver = bibliopixel.drivers.SimPixel.SimPixel(num=12)
led = bibliopixel.layout.Strip(driver)
animation = bibliopixel.animation.tests.StripChannelTest(led)
led.run(max_steps=5)
NEXT: ProjectSections
see also: MultipleDriverProjects