Show:

BO.Pin Class

Each analog and digital pin of the physical I/O board is represented by a Pin object. The Pin object is the foundation for many of the io objects and is also very useful on its own. See the Using The Pin Object Guide on http://breakoutjs.com for a detailed overview.

Constructor

BO.Pin

(
  • number
  • type
)

Defined in src/core/Pin.js:23

Parameters:

  • number Number

    The pin number

  • type Number

    The type of pin

Methods

addEventListener

(
  • type
  • listener
)

Parameters:

  • type String

    The event type

  • listener Function

    The function to be called when the event is fired

addFilter

(
  • newFilter
)

Defined in src/core/Pin.js:366

Add a new filter to the Pin.

Parameters:

  • newFilter FilterBase

    A filter object that extends FilterBase.

addGenerator

(
  • newGenerator
)

Defined in src/core/Pin.js:410

Add a new generator to the Pin. A pin can only have one generator assigned. Assigning a new generator will replace the previously assigned generator.

Parameters:

  • newGenerator GeneratorBase

    A generator object that extends GeneratorBase.

applyFilters

() private

Defined in src/core/Pin.js:456

autoSetValue

() private

Defined in src/core/Pin.js:447

calculateMinMaxAndMean

() private

Defined in src/core/Pin.js:339

From funnel Pin.as

clear

()

Defined in src/core/Pin.js:357

Resets the minimum, maximum, average and lastValue of the pin.

clearWeight

() private

Defined in src/core/Pin.js:329

From funnel Pin.as

detectChange

() private

Defined in src/core/Pin.js:311

Dispatch a Change event whenever a pin value changes

dispatchEvent

(
  • type
  • optionalParams
)

Parameters:

  • type Event

    The Event object.

  • optionalParams Object

    Optional parameters passed as an object. return {boolean} True if dispatch is successful, false if not.

getCapabilities

() Object

Defined in src/core/Pin.js:283

An object storing the capabilities of the pin.

Returns:

Object:

An object describing the capabilities of this Pin.

getType

() Number

Defined in src/core/Pin.js:261

The type/mode of the pin (0: DIN, 1: DOUT, 2: AIN, 3: AOUT / PWM, 4: SERVO, 5: SHIFT, 6: I2C). Use IOBoard.setDigitalPinMode(pinNumber) to set the pin type.

Returns:

Number:

The pin type/mode

hasEventListener

(
  • type
)

Parameters:

  • type String

    The event type return {boolean} True is listener exists for this type, false if not.

removeAllFilters

()

Defined in src/core/Pin.js:439

Removes all filters from the pin.

removeEventListener

(
  • type
  • listener
)

Parameters:

  • type String

    The event type

  • listener Function

    The function to be called when the event is fired

removeFilter

(
  • filterToRemove
)

Defined in src/core/Pin.js:388

Remove a specified filter from the Pin.

Parameters:

  • filterToRemove FilterBase

    The filter to remove.

removeGenerator

()

Defined in src/core/Pin.js:427

Removes the generator from the pin.

Properties

analogNumber

Number

Defined in src/core/Pin.js:76

[read-only] The analog pin number used by the IOBoard (printed on board or datasheet).

analogReadResolution

Number

Defined in src/core/Pin.js:146

[read-only] The analog read resolution for this pin.

This is the analog read resolution specified by Arduino rather than the resolution specified by the microcontroller datasheet.

analogWriteResolution

Number

Defined in src/core/Pin.js:134

[read-only] The analog write (PWM) resolution for this pin.

This is the PWM resolution specified by Arduino rather than the resolution specified by the microcontroller datasheet.

average

Number

Defined in src/core/Pin.js:158

[read-only] The average value of the pin over time. Call clear() to reset.

filters

FilterBase

Defined in src/core/Pin.js:240

Get and set filters for the Pin.

generator

GeneratorBase

Defined in src/core/Pin.js:252

[read-only] Get a reference to the current generator.

lastValue

Number

Defined in src/core/Pin.js:222

[read-only] The last pin value.

maximum

Number

Defined in src/core/Pin.js:178

[read-only] The maximum value of the pin over time. Call clear() to reset.

minimum

Number

Defined in src/core/Pin.js:168

[read-only] The minimum value of the pin over time. Call clear() to reset.

number

Number

Defined in src/core/Pin.js:86

[read-only] The pin number corresponding to the Arduino documentation for the type of board.

Pin.AIN

Unknown static

Defined in src/core/Pin.js:548

Pin.AOUT

Unknown static

Defined in src/core/Pin.js:553

Pin.DIN

Unknown static

Defined in src/core/Pin.js:538

Pin.DOUT

Unknown static

Defined in src/core/Pin.js:543

Pin.HIGH

Unknown static

Defined in src/core/Pin.js:516

Pin.I2C

Unknown static

Defined in src/core/Pin.js:573

Pin.INPUT_PULLUP

Unknown static

Defined in src/core/Pin.js:599

Pin.LOW

Unknown static

Defined in src/core/Pin.js:521

Pin.OFF

Unknown static

Defined in src/core/Pin.js:531

Pin.ON

Unknown static

Defined in src/core/Pin.js:526

Pin.ONEWIRE

Unknown static

Defined in src/core/Pin.js:578

Pin.PWM

Unknown static

Defined in src/core/Pin.js:558

Pin.SERIAL

Unknown static

Defined in src/core/Pin.js:588

Placeholder only - not yet supported

Pin.SERIAL

Unknown static

Defined in src/core/Pin.js:594

Pin.SERVO

Unknown static

Defined in src/core/Pin.js:563

Pin.SHIFT

Unknown static

Defined in src/core/Pin.js:568

Pin.STEPPER

Unknown static

Defined in src/core/Pin.js:583

Pin.TOTAL_PIN_MODES

Unknown static

Defined in src/core/Pin.js:604

preFilterValue

Number

Defined in src/core/Pin.js:231

[read-only] The value before any filters were applied.

state

Number

Defined in src/core/Pin.js:188

[read-only] The state of the pin. For output modes, the state is any value that has been previously written to the pin. For input modes, the state is typically zero, however for digital inputs the state is the status of the pullup resistor.

This propery is populated by calling the queryPinState method of the IOBoard object. This is useful if there are multiple client applications connected to a single physical IOBoard and you want to get the state of a pin that is set by another client application.

value

Number

Defined in src/core/Pin.js:206

The current digital or analog value of the pin.

Events

fallingEdge

BO.PinEvent.FALLING_EDGE

Defined in src/core/Pin.js:628

The change event is dispatched when the pin value decreased (from 1 to 0).

Event Payload:

  • target BO.Pin

    A reference to the Pin object.

pinChange

BO.PinEvent.CHANGE

Defined in src/core/Pin.js:613

The pinChange event is dispatched when the pin value changes.

Event Payload:

  • target BO.Pin

    A reference to the Pin object.

risingEdge

BO.PinEvent.RISING_EDGE

Defined in src/core/Pin.js:620

The risingEdge event is dispatched when the pin value increased (from 0 to 1).

Event Payload:

  • target BO.Pin

    A reference to the Pin object.