Skip to content

Projects

Tom Swirly edited this page Jan 30, 2018 · 17 revisions

Projects and settings.

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.

Example of a project file.

{
    "driver": {
        "typename": "simpixel",
        "num": 12
    },

    "layout": "strip"
    "animation": {
        "typename": "bibliopixel.animation.tests.StripChannelTest"
    },

    "run": {
        "max_steps": 5
    },

    "path": "/development/BiblioPixelAnimations"
}

Details

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

driver, layout, animation, and run are JSON objects. path is either a list of strings, or a single string containing a list of paths separated by colons.

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.

The path section is either a list of directories to be added to sys.path, or it's a single string, which is a list of directories joined by :.
These directories are added to sys.path before your project runs.

So the example above corresponds to the following code:

sys.path.append('/development/BiblioPixelAnimations')
driver = bibliopixel.drivers.SimPixel.SimPixel(num=12)
led = bibliopixel.layout.Strip(driver)
animation = bibliopixel.animation.tests.StripChannelTest(led)
led.run(max_steps=5)

See also: MultipleDriverProjects

Clone this wiki locally