Ambient light module

The PyMetaWear implementation of the libmetawear ambient light module.

It is initialized at the creation of the MetaWearClient client and can then be accessed in the ambient_light attribute of the client.

Data streaming example

If you need a real time stream of sensor data, use the notifications() method on the ambient_light module:

from pymetawear.client import MetaWearClient

c = MetaWearClient('DD:3A:7D:4D:56:F0')

print("Write ambient light settings...")
c.ambient_light.set_settings(gain=4, integration_time=200, measurement_rate=200)

def ambient_light_callback(data):
    """Handle a (epoch, data) ambient light data tuple."""
    print("Epoch time: [{0}] Data: {1}".format(data[0], data[1]))

# Enable notifications and register a callback for them.
c.ambient_light.notifications(ambient_light_callback)

API

Ambient Light module

Created by hbldh <henrik.blidh@nedomkull.com> on 2016-04-28 Modified by lkasso <hello@mbientlab.com>

class pymetawear.modules.ambientlight.AmbientLightModule(board, module_id)[source]

MetaWear Ambient Light module implementation.

Parameters:
  • board (ctypes.c_long) – The MetaWear board pointer value.
  • debug (bool) – If True, module prints out debug information.
module_name

Get module name.

Returns:The name of this module.
Return type:str