Skip to content

Projects

Adam Haile edited this page Jun 24, 2017 · 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": "bibliopixel.drivers.SimPixel.DriverSimPixel",
        "num": 12
    },

    "layout": {
        "typename": "bibliopixel.led.strip.Strip"
    },

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

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

    "path": "/development/BiblioPixelAnimations"
}

Details

A project is a JSON object with five named sections.

  • driver: identifies the hardware driving the LED and its characteristics.
  • layout: represents the geometric layout of the LEDs in one or more drivers.
  • animation: a program that changes the LEDs over time.
  • run: time settings for the animation.
  • path: a list of directories to add to the PYTHONPATH

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)
Clone this wiki locally