plumbing occamdoc

The Plumbing library is under development. You are encouraged to suggest additions, and encouraged even further to write PROCs that you think should be available and submit them for inclusion.

Included here is the occamdoc for the library as of 2010-02-18.

occamdoc for plumbing

The Plumbing library.

PROCs in this module generally have arguments in this order:

  • non-channels;
  • input channels;
  • output channels.

Index

Declarations

plumbing.module:30Process digital.output

PROC digital.output (VAL INT pin, CHAN LEVEL in?)

Set digital levels on a pin. Reads LEVEL values (LOW or HIGH) on the input channel, and sets the value of the specified pin accordingly.

Parameters:

VAL INT pin The Arduino pin number
CHAN LEVEL in Pin levels (LOW or HIGH)

plumbing.module:48Process digital.input

PROC digital.input (VAL INT pin, CHAN LEVEL out!)

Read digital levels on pin 2 or 3. For only pin 2 or pin 3 on the Arduino, this procedure will output a LEVEL (either LOW or HIGH) whenever the pin changes value.

Parameters:

VAL INT pin The Arduino pin number (2 or 3 only)
CHAN LEVEL out The LEVEL, output when the pin changes level.

plumbing.module:97Process debounce

PROC debounce (CHAN LEVEL in?, out!)

Debounce a channel. Debounces a channel of LEVELs. Specifically, if multiple values come in within the DEBOUNCE.TIME (currently 50ms), only the first value is passed through.

Parameters:

CHAN LEVEL in The incoming LEVEL values
CHAN LEVEL out The outgoing LEVEL values, debounced

plumbing.module:124Process level.to.signal

PROC level.to.signal (CHAN LEVEL in?, CHAN SIGNAL out!)

Convert a LEVEL to a SIGNAL. Consumes a stream of LEVEL values, and emits a SIGNAL for each LEVEL received, regardless of whether it is LOW or HIGH.

Parameters:

CHAN LEVEL in Input LEVEL values.
CHAN SIGNAL out Output SIGNALs.

plumbing.module:138Process invert.level

PROC invert.level (CHAN LEVEL in?, out!)

Invert LEVELs. Reads in LEVEL values, and outputs the opposite. Upon receiving a LOW, sends a HIGH, and visa versa.

Parameters:

CHAN LEVEL in Incoming LEVEL values.
CHAN LEVEL out Outgoing LEVEL values, inverted.

plumbing.module:153Process button.press

PROC button.press (VAL INT pin, CHAN SIGNAL out!)

Watches for button presses on pin 2 or 3. When a button is pressed (must be attached to pin 2 or 3) a SIGNAL is generated. Uses digital.input, debounce, and level.to.signal.

Parameters:

VAL INT pin The pin the button is connected to (must be 2 or 3)
CHAN SIGNAL out SIGNALs generated when the button is pressed.

plumbing.module:166Process tick

PROC tick (VAL INT period, CHAN SIGNAL out!)

Generates a consistent stream of SIGNALs. Every period milliseconds, a SIGNAL is generated.

Parameters:

VAL INT period A delay time in milliseconds.
CHAN SIGNAL out SIGNALs generated after the given delay.

plumbing.module:181Process toggle

PROC toggle (VAL LEVEL initial.level, CHAN SIGNAL in?, CHAN LEVEL out!)

Outputs an alternating stream of LEVEL values. Starting with an initial level (either LOW or HIGH), this process outputs a stream of alternating LEVEL values upon request. On receiving a SIGNAL, the next LEVEL is emitted

Parameters:

VAL LEVEL initial.level Either LOW or HIGH to start.
CHAN SIGNAL in The request line.
CHAN LEVEL out The alternating stream of LEVEL values.

plumbing.module:196Process pin.toggle

PROC pin.toggle (VAL INT pin, VAL LEVEL initial.level, CHAN SIGNAL in?)

Drives a pin alternately LOW and HIGH. Upon request, alternates the level of a pin from LOW to HIGH.

Parameters:

VAL INT pin The (digital) Arduino pin we want to drive.
VAL LEVEL initial.level Either LOW or HIGH.
CHAN SIGNAL in The request line.

plumbing.module:217Process heartbeat

PROC heartbeat ()

A parallel health monitor. Blinks the LED.PIN (or pin 13) on the Arduino every 500 ms.

plumbing.module:230Process clamp

PROC clamp (VAL INT low, high, CHAN INT in?, out!)

Limits the range of values in a stream. Takes a low and high limit, and any integers read in that are below the 'low' value are clamped to low, and likewise with the 'high' value.

Parameters:

VAL INT low The lower limit for valid numbers.
VAL INT high The upper limit for valid numbers.
CHAN INT in The input stream of INTs.
CHAN INT out The output stream of INTs.

plumbing.module:252Process pwm

PROC pwm (VAL INT pin, CHAN INT level?)

Writes an analog value to a pin. For a given (analog) pin, sets the level to a value between 0 and 255. Negative values are treated as 0, and values greater than 255 are treated as 255.

Parameters:

VAL INT pin The Arduino pin number
CHAN INT level The input level.

plumbing.module:277Process adc

PROC adc (VAL INT pin, CHAN SIGNAL req?, CHAN INT val!)

Read an analog value. For the given pin, will do an analog read of that pin and emit the value upon request. Currently not parallel safe.

Parameters:

VAL INT pin The Arduino pin number
CHAN SIGNAL req The request line.
CHAN INT val The current analog reading, 0 - 1023
Creative Commons License This work is licensed under a CC BY-SA 3.0 License.