Class BO.io.SoftPot
Extends
BO.PhysicalInputBase.
Creates an interface to a SoftPot sensor. A softpot is a type of
analog resistive sensor that acts as a type of slider input. There are
straight and curved variations. This object provides a number of useful
events such as Press, Release, Drag, Tap and capturing Flick gestures.
See Breakout/examples/sensors/softpot.html for an example application.
Defined in: SoftPot.js.
| Constructor Attributes | Constructor Name and Description |
|---|---|
|
BO.io.SoftPot(board, pin, softPotLength)
A softpot analog sensor.
|
| Field Attributes | Field Name and Description |
|---|---|
|
The current distance from the press point.
|
|
|
The minimum distance required to trigger a drag event.
|
|
|
The minimum distance required to trigger a flick event.
|
|
|
The minimum value required to set the Release state.
|
|
|
The maximum time (in milliseconds) between a press and release in order to
trigger a TAP event.
|
|
|
The current value.
|
| Method Attributes | Method Name and Description |
|---|---|
|
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 Attributes | Event Name and Description |
|---|---|
|
The softPotDrag event is dispatched when a drag is detected along
the length of the softpot sensor.
|
|
|
The softPotFlickDown event is dispatched when a flick gesture is
detected in the direction away from the sensor pins.
|
|
|
The softPotFlickUp event is dispatched when a flick gesture is detected
in the direction of the sensor pins.
|
|
|
The softPotPressed event is dispatched when pressure is applied to
the softpot surface.
|
|
|
The softPotReleased event is dispatched when pressure is released from
the softpot surface.
|
|
|
The softPotTap event is dispatched when a press and release occurs
in in less than the duration specified by the tapTimeout property.
|
Class Detail
BO.io.SoftPot(board, pin, softPotLength)
A softpot analog sensor.
- Parameters:
- {IOBoard} board
- A reference to the IOBoard instance
- {Pin} pin
- A reference to the Pin the softpot is connected to.
- {Number} softPotLength
- The length of the softpot in mm. Default = 100.
Field Detail
{Number}
distanceFromPressed
The current distance from the press point.
{Number}
minDragMovement
The minimum distance required to trigger a drag event. Change this value to fine tune the drag response.
{Number}
minFlickMovement
The minimum distance required to trigger a flick event. Change this value to fine tune the flick gesture.
{Number}
minValue
The minimum value required to set the Release state. This number should be as
close to zero as possible. Increase this value if you are noticing fluttering
between the Pressed and Released states. Default value = 0.01;
{Number}
tapTimeout
The maximum time (in milliseconds) between a press and release in order to
trigger a TAP event.
{Number}
value
The current value.
Method Detail
setRange(minimum, maximum)
Scale from the minimum and maximum input values to 0.0 -> 1.0.
- Parameters:
- {Number} minimum
- The minimum value
- {Number} maximum
- The maximum value
Event Detail
{BO.io.SoftPotEvent.DRAG}
softPotDrag
The softPotDrag event is dispatched when a drag is detected along
the length of the softpot sensor.
- This event has the following properties:
- {BO.io.SoftPot} target
- A reference to the SoftPot object
{BO.io.SoftPotEvent.FLICK_DOWN}
softPotFlickDown
The softPotFlickDown event is dispatched when a flick gesture is
detected in the direction away from the sensor pins.
- This event has the following properties:
- {BO.io.SoftPot} target
- A reference to the SoftPot object
{BO.io.SoftPotEvent.FLICK_UP}
softPotFlickUp
The softPotFlickUp event is dispatched when a flick gesture is detected
in the direction of the sensor pins.
- This event has the following properties:
- {BO.io.SoftPot} target
- A reference to the SoftPot object
{BO.io.SoftPotEvent.PRESS}
softPotPressed
The softPotPressed event is dispatched when pressure is applied to
the softpot surface.
- This event has the following properties:
- {BO.io.SoftPot} target
- A reference to the SoftPot object
{BO.io.SoftPotEvent.RELEASE}
softPotReleased
The softPotReleased event is dispatched when pressure is released from
the softpot surface.
- This event has the following properties:
- {BO.io.SoftPot} target
- A reference to the SoftPot object
{BO.io.SoftPotEvent.TAP}
softPotTap
The softPotTap event is dispatched when a press and release occurs
in in less than the duration specified by the tapTimeout property.
- This event has the following properties:
- {BO.io.SoftPot} target
- A reference to the SoftPot object
