Class Index | File Index

Classes


Class BO.io.Potentiometer


Extends BO.PhysicalInputBase.

Creates an interface to an analog input sensor. This may be a potentiometer (dial) or any other analog input that is connected to a single analog pin.

Defined in: Potentiometer.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
BO.io.Potentiometer(board, pin, enableSmoothing)
The Potentiometer object can be used for any generic analog input.
Field Summary
Field Attributes Field Name and Description
 
[read-only] Get the (pre-filtered) average value of the potentiometer
 
[read-only] Get the (pre-filtered) maximum value read by the potentiometer.
 
[read-only] Get the (pre-filtered) minimum value read by the potentiometer.
 
[read-only] Get the value of the potentiometer before filters are applied.
 
[read-only] The current value of the potentiometer.
Method Summary
Method Attributes Method Name and Description
 
Resets the minimum, maximum and average values.
 
setRange(minimum, maximum)
Scale from the minimum and maximum input values to 0.0 -> 1.0.
Methods borrowed from class BO.PhysicalInputBase:
addEventListener, dispatchEvent, hasEventListener, removeEventListener
Event Summary
Event Attributes Event Name and Description
 
The change event is dispatched when the potentiometer value changes.
Class Detail
BO.io.Potentiometer(board, pin, enableSmoothing)
The Potentiometer object can be used for any generic analog input. It provides a higher level of abstraction around an analog input pin.
Parameters:
{IOBoard} board
A reference to the IOBoard instance that the servo is attached to.
{Pin} pin
A reference to the Pin the potentiometer is connected to.
{Boolean} enableSmoothing
True to enable smoothing, false to disable. Default is false.
Field Detail
{Number} average
[read-only] Get the (pre-filtered) average value of the potentiometer

{Number} maximum
[read-only] Get the (pre-filtered) maximum value read by the potentiometer.

{Number} minimum
[read-only] Get the (pre-filtered) minimum value read by the potentiometer.

{Number} preFilterValue
[read-only] Get the value of the potentiometer before filters are applied.

{Number} value
[read-only] The current value of the potentiometer.
Method Detail
clear()
Resets the minimum, maximum and average values.

setRange(minimum, maximum)
Scale from the minimum and maximum input values to 0.0 -> 1.0. This is useful for sensors such as a flex sensor that may not return the full range of 0 to 1.
Parameters:
{Number} minimum
The new minimum range (must be less than the maximum).
{Number} maximum
The new maximum range.
Event Detail
{BO.io.PotEvent.CHANGE} change
The change event is dispatched when the potentiometer value changes.
pot.addEventListener(PotEvent.CHANGE, onValueChange);
function onValueChange(event) {
  console.log("value = " + event.target.value);	
}
This event has the following properties:
{BO.Potentiometer} target
A reference to the Potentiometer object

Documentation generated by JsDoc Toolkit 2.4.0 on Mon Mar 12 2012 23:27:53 GMT-0400 (EDT)