evothings.tisensortag. SensorTagInstance
Source: evothings-libraries/
Abstract SensorTag instance object that defines a common interface.
Methods
- celsiusToFahrenheit(celsius)
- luxometerCallback(fun, interval)
- luxometerOff()
- luxometerOn()
- accelerometerCallback(fun, interval)
- accelerometerOff()
- accelerometerOn()
- barometerCallback(fun, interval)
- barometerOff()
- barometerOn()
- callErrorCallback()
- callStatusCallback()
- errorCallback(fun)
- getDeviceModel()
- getFirmwareString()
- gyroscopeCallback(fun, interval, axes)
- gyroscopeOff()
- gyroscopeOn()
- humidityCallback(fun, interval)
- humidityOff()
- humidityOn()
- isAccelerometerAvailable()
- isBarometerAvailable()
- isGyroscopeAvailable()
- isHumidityAvailable()
- isKeypressAvailable()
- isLuxometerAvailable()
- isMagnetometerAvailable()
Methods
celsiusToFahrenheit(celsius)
Convert Celsius to Fahrenheit.
Parameter
Name | Type | Optional | Description |
---|---|---|---|
celsius |
|
|
Temperature in Celsius. |
- Returns
-
Temperature converted to Fahrenheit.
luxometerCallback(fun, interval)
Public. Set the luxometer notification callback.
Parameters
Name | Type | Optional | Description |
---|---|---|---|
fun |
|
|
success callback called repeatedly: fun(data) |
interval |
|
|
luxometer rate in milliseconds. |
luxometerOff()
Public. Turn off luxometer notification.
luxometerOn()
Public. Turn on luxometer notification.
accelerometerCallback(fun, interval)
Public. Set the accelerometer notification callback.
Parameters
Name | Type | Optional | Description |
---|---|---|---|
fun |
|
|
success callback called repeatedly: fun(data) |
interval |
|
|
accelerometer rate in milliseconds. |
accelerometerOff()
Public. Turn off accelerometer notification (SensorTag 1).
accelerometerOn()
Public. Turn on accelerometer notification (SensorTag 1).
barometerCallback(fun, interval)
Public. Set the barometer notification callback.
Parameters
Name | Type | Optional | Description |
---|---|---|---|
fun |
|
|
success callback called repeatedly: fun(data) |
interval |
|
|
barometer rate in milliseconds. |
barometerOff()
Public. Turn off barometer notification.
barometerOn()
Public. Turn on barometer notification.
callErrorCallback()
Public. Call the error handler function.
callStatusCallback()
Public. Call the status handler function.
errorCallback(fun)
Public. Set the error handler function.
Parameter
Name | Type | Optional | Description |
---|---|---|---|
fun |
|
|
error callback: fun(error) |
getDeviceModel()
Public. Get device model number.
getFirmwareString()
Public. Get firmware string.
gyroscopeCallback(fun, interval, axes)
Public. Set the gyroscope notification callback.
Parameters
Name | Type | Optional | Description |
---|---|---|---|
fun |
|
|
success callback called repeatedly: fun(data) |
interval |
|
|
gyroscope rate in milliseconds. |
axes |
|
|
(optional) the axes to enable ((z << 2) | (y << 1) | x) Only available on SensorTag CC2541. Axis parameter values are: 1 = X only, 2 = Y only, 3 = X and Y, 4 = Z only, 5 = X and Z, 6 = Y and Z, 7 = X, Y and Z. |
gyroscopeOff()
Public. Turn off gyroscope notification (SensorTag 1).
gyroscopeOn()
Public. Turn on gyroscope notification (SensorTag 1).
humidityCallback(fun, interval)
Public. Set the humidity notification callback.
Parameters
Name | Type | Optional | Description |
---|---|---|---|
fun |
|
|
success callback called repeatedly: fun(data) |
interval |
|
|
humidity rate in milliseconds. |
humidityOff()
Public. Turn off humidity notification.
humidityOn()
Public. Turn on humidity notification.
isAccelerometerAvailable()
Public. Checks if the accelerometer sensor is available.
isBarometerAvailable()
Public. Checks if the barometer sensor is available.
isGyroscopeAvailable()
Public. Checks if the gyroscope sensor is available.
isHumidityAvailable()
Public. Checks if the humidity sensor is available.
isKeypressAvailable()
Public. Checks if the keypress sensor is available.
isLuxometerAvailable()
Public. Checks if the luxometer sensor is available.
isMagnetometerAvailable()
Public. Checks if the magnetometer sensor is available.
isMovementAvailable()
Public. Checks if movement sensor is available that combines accelerometer, gyroscope, and magnetometer.
isTemperatureAvailable()
Public. Checks if the Temperature sensor is available.
keypressCallback(fun)
Public. Set the keypress notification callback.
Parameter
Name | Type | Optional | Description |
---|---|---|---|
fun |
|
|
success callback called when a key is pressed: fun(data) |
keypressOff()
Public. Turn off keypress notification.
keypressOn()
Public. Turn on keypress notification.
magnetometerCallback(fun, interval)
Public. Set the magnetometer notification callback.
Parameters
Name | Type | Optional | Description |
---|---|---|---|
fun |
|
|
success callback called repeatedly: fun(data) |
interval |
|
|
magnetometer rate in milliseconds. |
magnetometerOff()
Public. Turn off magnetometer notification (SensorTag 1).
magnetometerOn()
Public. Turn on magnetometer notification.
statusCallback(fun)
Public. Set the status handler function.
Parameter
Name | Type | Optional | Description |
---|---|---|---|
fun |
|
|
callback: fun(status) |
temperatureCallback(fun, interval)
Public. Set the IR temperature notification callback.
Parameters
Name | Type | Optional | Description |
---|---|---|---|
fun |
|
|
success callback called repeatedly: fun(data) |
interval |
|
|
update rate in milliseconds (min 300ms) |
temperatureOff()
Public. Turn off temperature notification.
temperatureOn()
Public. Turn on temperature notification.