Bibliopixel Animations

I am relatively new to Python. If this question is more appropriate on a Python forum I will seek an answer elsewhere.

I want to start an animation and then go do other stuff while the animation runs.

In following the examples in Bibliopixel Animations the actual show starts when I run anim.run().

But I than stay in anim.run() until I interrupt out of it.

I did set up an KeyboardInterrupt exception so that on Interrupt I return to the main part of the program rather then crashing the program.

How do I let the animation run on it’s own while the main program continues to monitor other events?

As an example of what I want the main program to provide is a means for the user to:

  • Enter a SPEED command to either slow down or speed up the animation
  • Enter BRIGHTNESS command to increase or decrease the brightness of the animation
  • Enter a PATTERN command to stop the current animation and start up another animation
  • In addition the pattern animations are only a portion of the overall functionality of playing the “blinky things”.
  • I want other commands to move the user on to other functions rather than just the animations.
    Right now I am limited to having to have the user press to end the current animation.

I do provide for the user to get a clean exit. As I mentioned above I catch the KeyboardInterrupt. At that point I clear all the leds and return to the main program.

But, my real desire is that the animation plays while the user and the program interact on another level.

Harold,
What type of UI are you actually trying to create for this?

You can do anim.run(threaded=True) but that as a ton of complications.

There’s a better way… Sadly this part is not well documented yet, though I’m currently working on it. But it’s not super complicated.

So, instead use our Projects feature.

The undocumented part is that there is a remote control feature for which you can see an example here:

https://github.com/adammhaile/BiblioPixelProjects/blob/master/SparkCon2017/1K.json

This will start up the animations and provide a web UI controller here: http://localhost:5000/

You don’t have to use the UI thought.

If you want to start the animation called GameOfLife call: http://localhost:5000/api/run_animation/GameOfLife

If you want to stop the animation, call: http://localhost:5000/api/stop/

If you want to set the brightness, call: http://localhost:5000/api/brightness/<0-255>

Absolutely read the projects docs linked above first. Once you have your head around that, each animation is defined like this:


{

"animation": {

"typename": "BiblioPixelAnimations.matrix.GameOfLife.GameOfLife",

"name": "GameOfLife"

},

"run": {

"fps": 15

}

}

The name field is what you’ll call out with the API. It must be unique.

The run field is the same things you’d use when calling anim.run() manually.

But all of this automatically runs threaded and lets you easily control it through the REST commands. For example:


import requests  # pip install requests

requests.get('[http://localhost:5000/api/run_animation/GameOfLife](http://localhost:5000/api/run_animation/GameOfLife)')

That would run the animation block from above. You don’t really need to inspect the response. It’s just json. But unless you are having errors, it’s nothing useful.

You should be able to do most of what you mentioned. Only thing it doesn’t really cover is the speed. You can setup the same animation multiple times with different speeds? Eventually I plan to add an option for sending data to a running animation or change FPS on the fly.

Hope that helps.

···

On Tue, Nov 28, 2017 at 6:31 PM, Harold Breeden hdb4720@gmail.com wrote:

I am relatively new to Python. If this question is more appropriate on a Python forum I will seek an answer elsewhere.

I want to start an animation and then go do other stuff while the animation runs.

In following the examples in Bibliopixel Animations the actual show starts when I run anim.run().

But I than stay in anim.run() until I interrupt out of it.

I did set up an KeyboardInterrupt exception so that on Interrupt I return to the main part of the program rather then crashing the program.

How do I let the animation run on it’s own while the main program continues to monitor other events?

As an example of what I want the main program to provide is a means for the user to:

  • Enter a SPEED command to either slow down or speed up the animation
  • Enter BRIGHTNESS command to increase or decrease the brightness of the animation
  • Enter a PATTERN command to stop the current animation and start up another animation
  • In addition the pattern animations are only a portion of the overall functionality of playing the “blinky things”.
  • I want other commands to move the user on to other functions rather than just the animations.
    Right now I am limited to having to have the user press to end the current animation.

I do provide for the user to get a clean exit. As I mentioned above I catch the KeyboardInterrupt. At that point I clear all the leds and return to the main program.

But, my real desire is that the animation plays while the user and the program interact on another level.

You received this message because you are subscribed to the Google Groups “Maniacal Labs Users” group.

To unsubscribe from this group and stop receiving emails from it, send an email to maniacal-labs-users+unsubscribe@googlegroups.com.

To post to this group, send email to maniacal-labs-users@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/maniacal-labs-users/c09e27f5-5477-4063-a83e-e49485861755%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

I think I have answered my own question.

I found this in the Bibliopixel Wiki https://github.com/ManiacalLabs/BiblioPixel/wiki/Animations

It describes how to run the animation in a separate thread.

I will play around with that and let you know if I have any further issues.

···

On Tuesday, November 28, 2017 at 5:31:21 PM UTC-6, Harold Breeden wrote:

I am relatively new to Python. If this question is more appropriate on a Python forum I will seek an answer elsewhere.

I want to start an animation and then go do other stuff while the animation runs.

In following the examples in Bibliopixel Animations the actual show starts when I run anim.run().

But I than stay in anim.run() until I interrupt out of it.

I did set up an KeyboardInterrupt exception so that on Interrupt I return to the main part of the program rather then crashing the program.

How do I let the animation run on it’s own while the main program continues to monitor other events?

As an example of what I want the main program to provide is a means for the user to:

  • Enter a SPEED command to either slow down or speed up the animation
  • Enter BRIGHTNESS command to increase or decrease the brightness of the animation
  • Enter a PATTERN command to stop the current animation and start up another animation
  • In addition the pattern animations are only a portion of the overall functionality of playing the “blinky things”.
  • I want other commands to move the user on to other functions rather than just the animations.
    Right now I am limited to having to have the user press to end the current animation.

I do provide for the user to get a clean exit. As I mentioned above I catch the KeyboardInterrupt. At that point I clear all the leds and return to the main program.

But, my real desire is that the animation plays while the user and the program interact on another level.

Thanks, Adam. Especially for the heads up that the Threaded has it’s own set of complications.

I will look over the Projects and see if that addresses the needs that I want to implement to make a seamless series of led animations.

The project will be under public display so we are wanting a smooth, seamless transition between displays.

I will let you know as I make progress and share the project with you upon completion.

Thanks again.

Harold

···

On Tuesday, November 28, 2017 at 5:31:21 PM UTC-6, Harold Breeden wrote:

I am relatively new to Python. If this question is more appropriate on a Python forum I will seek an answer elsewhere.

I want to start an animation and then go do other stuff while the animation runs.

In following the examples in Bibliopixel Animations the actual show starts when I run anim.run().

But I than stay in anim.run() until I interrupt out of it.

I did set up an KeyboardInterrupt exception so that on Interrupt I return to the main part of the program rather then crashing the program.

How do I let the animation run on it’s own while the main program continues to monitor other events?

As an example of what I want the main program to provide is a means for the user to:

  • Enter a SPEED command to either slow down or speed up the animation
  • Enter BRIGHTNESS command to increase or decrease the brightness of the animation
  • Enter a PATTERN command to stop the current animation and start up another animation
  • In addition the pattern animations are only a portion of the overall functionality of playing the “blinky things”.
  • I want other commands to move the user on to other functions rather than just the animations.
    Right now I am limited to having to have the user press to end the current animation.

I do provide for the user to get a clean exit. As I mentioned above I catch the KeyboardInterrupt. At that point I clear all the leds and return to the main program.

But, my real desire is that the animation plays while the user and the program interact on another level.

Honestly, in that case I recommend wrapping all your animations up into one uber animation class with it’s own control mechanism.

···

On Tue, Nov 28, 2017 at 7:26 PM, Harold Breeden hdb4720@gmail.com wrote:

Thanks, Adam. Especially for the heads up that the Threaded has it’s own set of complications.

I will look over the Projects and see if that addresses the needs that I want to implement to make a seamless series of led animations.

The project will be under public display so we are wanting a smooth, seamless transition between displays.

I will let you know as I make progress and share the project with you upon completion.

Thanks again.

Harold

On Tuesday, November 28, 2017 at 5:31:21 PM UTC-6, Harold Breeden wrote:

I am relatively new to Python. If this question is more appropriate on a Python forum I will seek an answer elsewhere.

I want to start an animation and then go do other stuff while the animation runs.

In following the examples in Bibliopixel Animations the actual show starts when I run anim.run().

But I than stay in anim.run() until I interrupt out of it.

I did set up an KeyboardInterrupt exception so that on Interrupt I return to the main part of the program rather then crashing the program.

How do I let the animation run on it’s own while the main program continues to monitor other events?

As an example of what I want the main program to provide is a means for the user to:

  • Enter a SPEED command to either slow down or speed up the animation
  • Enter BRIGHTNESS command to increase or decrease the brightness of the animation
  • Enter a PATTERN command to stop the current animation and start up another animation
  • In addition the pattern animations are only a portion of the overall functionality of playing the “blinky things”.
  • I want other commands to move the user on to other functions rather than just the animations.
    Right now I am limited to having to have the user press to end the current animation.

I do provide for the user to get a clean exit. As I mentioned above I catch the KeyboardInterrupt. At that point I clear all the leds and return to the main program.

But, my real desire is that the animation plays while the user and the program interact on another level.

You received this message because you are subscribed to the Google Groups “Maniacal Labs Users” group.

To unsubscribe from this group and stop receiving emails from it, send an email to maniacal-labs-users+unsubscribe@googlegroups.com.

To post to this group, send email to maniacal-labs-users@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/maniacal-labs-users/0f7fa40a-81d7-4b9d-9867-487de6f9f342%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.