[C.CC USERS] wiring.module Question

Matt Jadud matt at jadud.com
Wed Oct 26 21:28:21 BST 2011


Hi Aaron,

On Wed, Oct 26, 2011 at 16:15, Aaron Ryan <bringfire at gmail.com> wrote:
> The Plumbing for Arduino manual doesn't cover the use of the wiring.module
> PROC's which would facilitate the transition between arduino
> functions/thinking, and occam-pi functions/thinking.

So, we have mixed feelings about wiring.module, and in fact, it is
currently the unloved child. In part, this is because the
wiring.module encourages sequential thinking, and it is easy to end up
in a situation where you have a very sequential program that does not
translate well to a more parallel/CSP-based approach.

For example, if you use an ADC process that is process-oriented, it
looks like this:

CHAN SIGNAL req?:
CHAN BYTE reading:
PAR
  ...
  adc (A0, VCC, req?, reading!)
  ...
  do.stuff.and.read(req!, reading?)
  ...

When ADC is encapsulated behind a client/server protocol, it
encourages you to think about talking to it over channels, and taking
a parallel-first or communication-first approach to developing your
solution. If you instead do ADC this way:

BYTE reading:
SEQ
  ...
  adc (A0, VCC, reading)
  do.something.with.reading(reading)
  ...

it becomes difficult to see this as a separate process. Further, you
end up in a situation where more than once PROC can read from A0
"simultaneously," which we can't easily control for. When you put it
behind a channel interface, then only one process can read from A0,
and if you want to use it elsewhere, you must communicate it on
through a pipeline (or some other network) to safely share it with
your friends.

> Are there some more in depth recommended resources for learning
> Occam/Occam-Pi, and more specifically is there anything that covers the
> wiring.module and its PROC's?

You can grab a zipfile of some out-of-print occam books here:

http://jadud.com/people/mcj/files/occam-books.zip

These will help with occam in general. There isn't anything that
specifically covers wiring.module, and... if you really wanted it,
I'll help you develop the docs. However, I think it goes against the
philosophy of decomposing problems in a process-oriented way.

> I am excited about exploring the possibilities of this new approach here at
> Sci-Arc.

I'm neigh upon starting some screencasts. If you have a list of
cookbook-style needs ("I'd like something that shows how to control a
servo," etc.), I'll make sure to incorporate it in my documentation
sprint. I have a bunch of students who will be doing things over the
coming weeks, and that will help force some more documentation being
produced.

As always, feel free to push back/ask/share. Any students who are
working with this are, of course, welcome here as well, and should
feel free to ask questions on the list.

Cheers,
Matt



More information about the users mailing list