Show:

BO.io.LED Class

Defined in: src/io/LED.js:22

Creates an interface to an LED. This object provides helpful methods for blinking and fading LEDs. To use the fading methods, the LED must be connected to a PWM pin on the I/O board.

PLEASE NOTE: To use the fade methods, or to use an waveform other than Oscillator.SQUARE the LED must be connected to a PWM pin.

SOURCE_DRIVE vs SYNC_DRIVE. If the Anode (longer LED pin) is connected to the microcontroller pin, then it is SOURCE_DRIVE. If the Cathode is connected to the microcontroller pin, then it is SYNC_DRIVE.

Constructor

BO.io.LED

(
  • board
  • ledPin
  • driveMode
)

Defined in src/io/LED.js:22

Parameters:

  • board IOBoard

    A reference to the IOBoard the LED is attached to.

  • ledPin Pin

    A reference to the Pin the LED is connected to.

  • driveMode Number

    The drive mode of the LED. Must be set to LED.SOURCE_MODE or LED.SYNC_MODE. SOURCE_MODE is default.

Methods

fadeIn

(
  • time
)

Defined in src/io/LED.js:174

The LED must be connected to a PWM pin to use this method.

Parameters:

  • time Number

    The fade-in time (in milliseconds).

fadeOut

(
  • time
)

Defined in src/io/LED.js:184

The LED must be connected to a PWM pin to use this method.

Parameters:

  • time Number

    The fade-out time (in milliseconds).

fadeTo

(
  • to
  • time
)

Defined in src/io/LED.js:194

The LED must be connected to a PWM pin to use this method.

Parameters:

  • to Number

    The new intensity value to fade to.

  • time Number

    The fade time (in milliseconds).

isOn

() Boolean

Defined in src/io/LED.js:121

Check if the LED is on.

Returns:

Boolean:

True if the LED is on, false if it is off.

off

()

Defined in src/io/LED.js:113

Turn the LED off.

on

()

Defined in src/io/LED.js:105

Turn the LED on.

stopBlinking

()

Defined in src/io/LED.js:163

Stop the LED blink cycle.

toggle

()

Defined in src/io/LED.js:130

Toggle the LED on or off.

Properties

intensity

Number

Defined in src/io/LED.js:80

Get or set the current value (intensity) of the LED.

LED.SOURCE_DRIVE

Unknown static

Defined in src/io/LED.js:223

LED.SYNC_DRIVE

Unknown static

Defined in src/io/LED.js:228