Module plumbing - The Plumbing library

The Plumbing library.

PROCs in this module generally have arguments in this order:

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

Index

Declarations

plumbing.module:65Process 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:94Process 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:110Process 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:125Process 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:142Process 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:159Process 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:198Process heartbeat

PROC heartbeat ()

A parallel health monitor.

plumbing.module:223Process adc

PROC adc (VAL INT analog.pin, VAL INT ref, CHAN SIGNAL in?, CHAN INT out!)

Reads the analog value of a given pin. Upon request, performs an analog to digital conversion, comparing the voltage at analog.pin with the specified reference voltage. No matter which reference is used, the value of out will always rest between 0 and 1023.

There is a safeguard put in place that should allow analog.pin to be properly read if written as 0, 1, 2, etc., but it is still recommended that one writes A0, A1, etc. to avoid confusion.

Parameters:

VAL INT analog.pin The Analog pin number. (A0, A1, A2)
VAL INT ref The source of the reference voltage. Either VCC (default), AREF (external), or INTERNAL (1.1v internal reference).
CHAN SIGNAL in The request line.
CHAN INT out The output channel for converted readings. 0 - 1023.

plumbing.module:248Process potentiometer.byte

PROC potentiometer.byte (VAL INT analog.pin, CHAN SIGNAL in?, CHAN BYTE out!)

Reads from a potentiometer and maps the incoming value to a BYTE. Upon request, the incoming value from a potentiometer (a knob, slider...) connected to analog.pin to will be mapped to an appropriate value between 0-255.

There is a safeguard put in place that should allow analog.pin to be properly read if written as 0, 1, 2, etc., but it is still recommended that one writes A0, A1, etc. to avoid confusion.

Parameters:

VAL INT analog.pin The analog pin the potentiometer is connected to.
CHAN SIGNAL in The request line.
CHAN BYTE out The output chanel for mapped values. 0-255.

plumbing.module:272Process clamp.byte

PROC clamp.byte (VAL BYTE low, high, CHAN BYTE in?, out!)

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

Parameters:

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

plumbing.module:296Process clamp.int

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

Limits the range of values in a stream. Takes low and high as limits, and any INTs read in that are below low 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:323Process crawl.byte

PROC crawl.byte (VAL BYTE high, step, VAL INT wait, CHAN BYTE out!)

Crawls a BYTE from 0 to high and back down (and back up, etc.). Pausing wait milliseconds between each signal send, and incrementing (in either direction) step between each send, the outgoing value is capped at 0 and high.

Parameters:

VAL BYTE high The upper limit of output values.
VAL BYTE step The increment between each send.
VAL INT wait The time - in milliseconds - to wait after a successful send before attempting another.
CHAN BYTE out The output stream of BYTEs.

plumbing.module:368Process crawl.int

PROC crawl.int (VAL INT high, step, VAL INT wait, CHAN INT out!)

Crawls an INT from 0 to high and back down (and back up, etc.). Pausing wait milliseconds between each signal send, and incrementing (in either direction) step between each send, the outgoing value is capped at 0 and high.

Parameters:

VAL INT high The upper limit of output values.
VAL INT step The increment between each send.
VAL INT wait The time - in milliseconds - to wait after a successful send before attempting another.
CHAN INT out The output stream of INTs.

plumbing.module:412Process pwm

PROC pwm (VAL INT board.pin, CHAN BYTE level?)

Writes an analog value to a pin. For a given (PWM) pin, sets the observed analog 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 board.pin The pin number.
CHAN BYTE level The input level channel.

plumbing.module:435Process pwm16

PROC pwm16 (VAL INT board.pin, VAL INT top, CHAN INT level?)

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

Be careful. Not every PWM pin is connected to a 16 bit timer, so not every pin labeled as a PWM can be used with this PROC.

Parameters:

VAL INT board.pin The Arduino pin number
VAL INT top The highest level top can be set to.
CHAN INT level The input level channel.

plumbing.module:460Process button.press

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

Watches for button presses on external level interrupt pins. When a button is pressed a SIGNAL is generated. Uses digital.input, debounce, and level.to.signal.

Parameters:

VAL INT board.pin The pin the button is connected to (pins 2 and 3 are safe bets).
CHAN SIGNAL out SIGNALs generated when the button is pressed.
online viagra without perscription cheap generic viagra online cheap generic viagra online cheap generic viagra