Class Attribute
Direction: Hex value indicating the tap direction. The direction can be determined in human readable form using get_logicalname
API and class name as KSensrvAccelerometerDirection
.
Set/Get Property
This sensor class provides additional functions that can be used to set or get some of the properties specific to this sensor.
The following table lists the set/get properties of the sensor class:
Set/Get properties | Description |
get_axis_active() |
Returns x, y, z values: 1 if axis is active else 0. |
set_axis_active([x=None, y=None, z=None]) |
Sets one or more axis as active. Pass 1 to set the axis and 0 to disable it. |
get_properties() |
Returns TapThresholdValue , TapDurationValue , TapLatencyValue , TapIntervalValue . |
set_properties([DblTapThresholdValue = None, DblTapDurationValue = None, DblTapLatencyValue = None, DblTapIntervalValue = None]) |
Sets the tap related properties. |
Example
from sensor import * import e32 class DemoApp(): def __init__(self): self.doubletap = AccelerometerDoubleTappingData() self.doubletap.set_axis_active(x=0, y=1, z=1) print "Active Axis are: ", self.doubletap.get_axis_active() self.doubletap.set_callback(data_callback=self.my_callback) def my_callback(self): print "Raw Direction value", self.doubletap.direction print "Direction: ", get_logicalname(KSensrvAccelerometerDirection, self.doubletap.direction) def run(self): self.doubletap.start_listening() if __name__ == '__main__': d = DemoApp() d.run() e32.ao_sleep(15) d.doubletap.stop_listening() print "Exiting Double Tap"
See About this document... for information on suggesting changes.