The NEW Build Your Own Arcade Controls
Main => Software Forum => Topic started by: Buddabing on June 06, 2005, 09:20:33 pm
-
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
-
I haven't really followed this project so forgive me if I'm retreading things here. I like your idea of a "scripting language", that's very cool.
How many degrees of brightness are there?
Is a port the equivalent of an individual LED?
It would be cool to have a macro/command to implement a degree of randomness. For example, with one command you could turn the LED board into a random, seizure-inducing mess. Could be neat if done in a certain way, I guess I'm thinking more along the lines of the Visualizations in Windows Media Player.
-
I had to read it a couple times and really think it over, but I think I understand.
I have a couple questions though.
1) As Veinman asked, how many degrees of brightness are there? Is this is hardware-related and/or dependant on the type of bulbs used?
2) There's 1 LED per port, correct?
3) To me the "macro" concept means "putting a whole bunch of commands in one easy-to-use statement". I understand how the include and repeat macros work, but how does the multiplex macro work? I mean, if there were no multiplex "macro" how would you build your primitives? Or is the ,multiplex macro a "special case"?
If I have (I assume the port numbers are 1-based, not 0-based?)
multiplex
{
{ 100 1 0 0 0 0 0 0 }
{ 100 1 + + + + + + }
}
...what would happen?
Great work, Buddabing! I can't wait to really see this in action!
It would be cool to have a macro/command to implement a degree of randomness. For example, with one command you could turn the LED board into a random, seizure-inducing mess. Could be neat if done in a certain way, I guess I'm thinking more along the lines of the Visualizations in Windows Media Player.
The "random macro" is a good idea! I want a seizure-inducing blink-fest to happen on my control panel when I make the next letter in Moon Patrol.. Or uncover an "elbow" in Gal's Panic!
-sab
-
I had to read it a couple times and really think it over, but I think I understand.
I have a couple questions though.
1) As Veinman asked, how many degrees of brightness are there?
-
2) There's 1 LED per port, correct?
Yes, unless the user has two or more LEDs in series.
In which case your board would control both/all of them at the same time (it can't distinguish between them if the bulbs are connected directly to each other). I just want to be clear.
The multiplex macro runs two or more primitives at the same time. In your case, the second primitive would probably overwrite the first one. I should probably check for that.
Okay, so take your example:
multiplex
{
include "foo.txt"
include "bar.txt"
repeat 10
{
{ 50 9 + + + + + + + + }
{ 50 9 0 0 0 0 0 0 0 0 }
}
}
The "multiplex" part only counts for the next level deep, right? Otherwise it would render the repeat meaningless (since either it wouldn't be "repeating" if each iteration ran at the same time, or if it did repeat and since it's muliplexing, it would repeat the second primative, { 50 9 0 0 0 0 0 0 0 0 }, 10 times). Do you know what I mean? Which scenario would play out?
Again, I just want to be clear.. Sorry for all the questions.
-sab
-
The multiplex macro runs two or more primitives at the same time. In your case, the second primitive would probably overwrite the first one. I should probably check for that.
-
Ok ok ok
I'm not going say what I think this does. So tell me what it does and I'll be like "Oh yeah, that's what I ment"
{ 50 1 50 0 0 0 0 0}
{ 50 1 100 50 }
{ 50 1 50 100 50}
{ 50 1 0 50 100 }
{ 50 1 0 0 50 }
{ 50 1 0 0 0 }
I'm a little slow... :)
-
{ 50 1 50 0 0 0 0 0}
{ 50 1 100 50 }
{ 50 1 50 100 50}
{ 50 1 0 50 100 }
{ 50 1 0 0 50 }
{ 50 1 0 0 0 }
LED
B 1 2 3 4 5 6
R 50 0 0 0 0 0
I 100 50 0 0 0 0
G 50 100 50 0 0 0
H 0 50 100 0 0 0
T 0 0 50 0 0 0
N 0 0 0 0 0 0
E
S
S
Are you building a Knight Rider cab? :)
-sab
-
Or for the kiddies :laugh:
{ 50 1 0 0 0 0 0 }
{ 100 3 + }
{ 100 2 + 0 }
{ 100 1 + 0 }
{ 100 2 + 0 }
{ 100 2 0 + }
{ 30 3 0 }
{ 100 3 + }
{ 30 3 0 }
{ 100 3 + }
{ 100 2 + 0 }
{ 30 2 0 }
{ 100 2 + }
{ 30 2 0 }
{ 100 2 + }
{ 100 2 0 + }
{ 100 3 0 0 + }
{ 30 5 0 }
{ 100 5 + }
{ 130 5 0 }
{ 100 3 + }
{ 100 2 + 0 }
{ 100 1 + 0 }
{ 100 2 + 0 }
{ 100 2 0 + }
{ 30 3 0 }
{ 100 3 + }
{ 30 3 0 }
{ 100 3 + }
{ 100 2 + 0 }
{ 30 2 0 }
{ 100 2 + }
{ 100 2 0 0 + }
{ 100 2 + 0 0 }
{ 150 1 + 0 }
-sab
-
So how would I send these commands from a program like DOSCab or WinCab Jukebox?
--Chris
-
So how would I send these commands from a program like DOSCab or WinCab Jukebox?
--Chris
The application interface is still a WIP. I can't complete it until after my prototype PCB is produced and assembled. I'll post it as soon as it is finalized.
If you like, PM me and I'll email you what I have.
-
So how would I send these commands from a program like DOSCab or WinCab Jukebox?
--Chris
The application interface is still a WIP. I can't complete it until after my prototype PCB is produced and assembled. I'll post it as soon as it is finalized.
If you like, PM me and I'll email you what I have.
That's okay, it doesn't matter until I can get my hands on a PCB... I've learned my lesson about trying to code for hardware I don't have...
-
I've made a couple of changes in the animation language.
The first change was to change the braces around the primitives to parentheses. This was done to simplify the parsing.
The second change was done to address a problem with the multiplex.
For example, for the following animation:
[code]multiplex
{
-
Hmm. Can you at least tell me if my thing "plays" Mary Had A Little Lamb? :)
-sab
-
Hmm.
-
I've added three more constructs to my animation language:
clear
This causes all LEDs to be turned off. Easy enough.
[code]ramp
{