Hello,
The wife is out of town, so I have been making some good progress on creating animations for my new LED controller.
I would like to open the floor to any suggestions that people might have.
An animation "primitive" is defined to be an open brace, a duration (in milliseconds), a starting port number on the controller, and a series of space-delimited percentages, or a + being 100%, then a close brace.
Here are some examples of animation primitives:
{ 50 1 0 0 0 0 0 0 0 0 0 } turn off 9 lights starting at port 1, for 50 ms.
{ 100 21 + + + } turn on 3 lights full starting at port 21 for 100 ms.
So, to develop animations all you have to do is string together sequences
of these primitives. Here's a sequence that successively turns on port 9
thru 16, starting at port 11:
{ 50 9 0 0 0 0 0 0 0 0 }
{ 50 11 + }
{ 50 11 0 + }
{ 50 12 0 + }
{ 50 13 0 + }
{ 50 14 0 + }
{ 50 15 0 + }
{ 50 9 + 0 0 0 0 0 0 0 }
{ 50 9 0 + }
{ 50 10 0 }
It can get to a bit tedious stringing all these primitives together, so I have defined some "macros".
The macros are: "include", "repeat", and "multiplex".
Include just reads in a different animation file, so you can use a sequence of primitives in multiple places.
Repeat simply repeats the following sequence of primitives a specified number of times. So to flash some lights you would do something like:
repeat 10
{
{ 50 9 + + + + + + + + }
{ 50 9 0 0 0 0 0 0 0 0 }
}
Multiplex takes two sequences of primitives and threads them together so that they happen at the same time.
multiplex
{
include "foo.txt"
include "bar.txt"
repeat 10
{
{ 50 9 + + + + + + + + }
{ 50 9 0 0 0 0 0 0 0 0 }
}
}
This would run three sequences at the same time, the ones defined in "foo.txt" and "bar.txt", and the repeated flashing. A multiplex operation will only end when the longest of its constituent sequences ends. So if
"bar.txt" takes a lot longer to complete, then the other two won't do anything until it does.
I would appreciate any ideas you guys might have on different helper macros that I can implement.
Regards,
Buddabing