Class Index | File Index

Classes


Class BO.io.LED

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.

Defined in: LED.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
BO.io.LED(board, ledPin, driveMode)

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.

Field Summary
Field Attributes Field Name and Description
 
Get or set the current value (intensity) of the LED.
Method Summary
Method Attributes Method Name and Description
 
blink(interval, times, wave)
 
fadeIn(time)
The LED must be connected to a PWM pin to use this method.
 
fadeOut(time)
The LED must be connected to a PWM pin to use this method.
 
fadeTo(to, time)
The LED must be connected to a PWM pin to use this method.
 
isOn()
Check if the LED is on.
 
off()
Turn the LED off.
 
on()
Turn the LED on.
 
Stop the LED blink cycle.
 
Toggle the LED on or off
Class Detail
BO.io.LED(board, ledPin, driveMode)

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.

Parameters:
{IOBoard} board
A reference to the IOBoard the LED is attached to.
{Pin} ledPin
A reference to the Pin the LED is connected to.
{Number} driveMode
The drive mode of the LED. Must be set to LED.SOURCE_MODE or LED.SYNC_MODE. SOURCE_MODE is default.
Field Detail
{Number} intensity
Get or set the current value (intensity) of the LED.
Method Detail
blink(interval, times, wave)
Parameters:
{Number} interval
The time interval to blink the LED.
{Number} times
The number of times the LED should blink. A value of 0 will blink forever.
{Function} wave
The waveform to apply (default is Oscillator.SQUARE)
See:
BO.generator.Oscillator

fadeIn(time)
The LED must be connected to a PWM pin to use this method.
Parameters:
{Number} time
The fade-in time (in milliseconds).

fadeOut(time)
The LED must be connected to a PWM pin to use this method.
Parameters:
{Number} time
The fade-out time (in milliseconds).

fadeTo(to, time)
The LED must be connected to a PWM pin to use this method.
Parameters:
{Number} to
The new intensity value to fade to.
{Number} time
The fade time (in milliseconds).

{Boolean} isOn()
Check if the LED is on.
Returns:
{Boolean} True if the LED is on, false if it is off.

off()
Turn the LED off.

on()
Turn the LED on.

stopBlinking()
Stop the LED blink cycle.

toggle()
Toggle the LED on or off

Documentation generated by JsDoc Toolkit 2.4.0 on Sun May 05 2013 16:30:02 GMT-0400 (EDT)