webduino.module.ADXL345
The ADXL345 class.
ADXL345 is a small, thin, ultralow power, 3-axis accelerometer.
Table of Contents
- Methods
- Attributes
Constructor
webduino.module.ADXL345
-
board
Parameters:
-
boardwebduino.BoardThe board that the ADXL345 accelerometer is attached to.
Methods
addListener
-
type -
listener
Add a listener for a certain type of event.
Parameters:
-
typeStringEvent type.
-
listenerFunctionEvent listener.
detect
-
callback
Start detection.
Parameters:
-
[callback]Function optionalDetection callback.
emit
-
type -
object,...
Emit an event of certain type.
Parameters:
-
typeStringEvent type.
-
[object,...]Object optionalEvent object(s).
listeners
-
type
Return the listener list bound to certain type of event.
Parameters:
-
typeStringEvnet type.
off
()
Stop detection.
on
-
callback
Start detection.
Parameters:
-
[callback]Function optionalDetection callback.
once
-
type -
listener
Add a one-time listener for a certain type of event.
Parameters:
-
typeStringEvent type.
-
listenerFunctionEvent listener.
refresh
()
Reset detection value.
removeAllListeners
-
type
Remove all listeners of certain type.
Parameters:
-
typeStringEvent type.
removeListener
-
type -
listener
Remove a listener for certain type of event.
Parameters:
-
typeStringEvent type.
-
listenerFunctionEvent listener.
setBaseAxis
-
axis
Set the base axis for calculation.
Parameters:
-
axisStringAxis to be set to, either
x,y, orz.
setDetectTime
-
detectTime
Set detecting time period.
Parameters:
-
detectTimeNumberThe time period for detecting, in ms.
setMaxListeners
-
n
Set maximum number of listeners that is allow to bind on an emitter.
Parameters:
-
nNumberNumber of listeners.
setSensitivity
-
sensitivity
Set detection sensitivity.
Parameters:
-
sensitivityNumberDetection sensitivity.
Attributes
Events
ADXL234Event.MESSAGE
Fires when the accelerometer senses a value change.