Class: Pin

Pin

Class representing an Espruino Pin.

Constructor

new Pin()

Author:
  • Loris Tissino (http://loris.tissino.it)
License:
  • MIT
Source:
See:

Methods

getInfo() → {Object}

Get information about this pin and its capabilities.
Source:
Returns:
An object containing information about this pin
Type
Object

getMode() → {string}

Returns the current mode of the given pin.
Source:
Returns:
The pin mode, as a string
Type
string

mode(mode)

Set the mode of the given pin.
Parameters:
Name Type Description
mode string The mode, a string that is either 'analog', 'input', 'input_pullup', 'input_pulldown', 'output', 'opendrain', 'af_output' or 'af_opendrain'
Source:

read() → {boolean}

Returns the input state of the pin as a boolean.
Source:
Returns:
The input state
Type
boolean

reset()

Sets the output state of the pin to a 0.
Source:

set()

Sets the output state of the pin to a 1.
Source:

write(value)

Sets the output state of the pin to the parameter given.
Parameters:
Name Type Description
value mixed Whether to set output high (true/1) or low (false/0)
Source:

writeAtTime(value, time)

Sets the output state of the pin to the parameter given at the specified time.
Parameters:
Name Type Description
value mixed Whether to set output high (true/1) or low (false/0)
time float Time at which to write
Source:
Throws:
"Not implemented"

xGetLastOutput() → {boolean}

Returns the last output to the Pin.
Source:
Returns:
The last output
Type
boolean