[C.CC USERS] 3 Binkin lights not in parallel

Matt Jadud matt at jadud.com
Sun Feb 27 16:32:06 GMT 2011


On Sun, Feb 27, 2011 at 10:27, ljam10 at juno.com <ljam10 at juno.com> wrote:
> Thanks, the logic makes sence.
>
> Is there any way this can be done using shortened Plumbing Code?

I think the challenge is that you have to manage your timing yourself
if you want this kind of synchronization. I can't easily abstract it
away for you, because that "start" time needs to be read from the
timer by you (the programmer), and passed into a delay process that
never reads from the clock. As a result, any delay you want to use
needs to have the "start" time passed to it. I don't think I can
easily hide that. (Suggestions from the team are welcome.)

Brainstorms (which should be discussed further on "developers"):

In theory, we could give you a "soft" timer interrupt: something you
could configure to trigger every (say) 500ms. Then, multiple processes
could "wait" for that interrupt to fire. It would require us to think
about how interrupts are handled (it is currently not possible for
multiple processes to "wait" on a single interrupt) and whether this
is a "bad" idea. (That is, what kind of badness could it introduce
into your program overall? Race hazards? Deadlock? Livelock?)

This could also be done with a BARRIER, where several processes are
synchronizing on it, and only one of them watches the clock. Then, all
the other processes wold release at the "same time." But... well, I
don't know if we have BARRIERs available on the Arduino (perhaps we
could enable them), and it would still require you to pass something
into the processes that were going to synchronize. At least it would
be a pattern explicitly supported by a construct in the language...

Cheers,
Matt



More information about the users mailing list