LED module

The PyMetaWear implementation of the libmetawear LED module.

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

Note

The API in the LED module is under rewriting, so expect changes to be made to it in future releases.

Example usage:

from pymetawear.client import MetaWearClient

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

# Blinking 10 times with green LED.
pattern = c.led.load_preset_pattern('blink', repeat_count=10)
c.led.write_pattern(pattern, 'g')
c.led.play()

API

LED module

Created by hbldh <henrik.blidh@nedomkull.com> on 2016-04-16

class pymetawear.modules.led.LEDModule(board)[source]

MetaWear Switch module implementation.

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

Plays any programmed patterns, and immediately plays any patterns programmed later.

load_preset_pattern(preset_name, **kwargs)[source]

Loads a preset configuration.

Parameters:
  • pattern (Led.Pattern) – One of the strings blink, pulse or solid.
  • preset_name (str) – One of the strings blink, pulse or solid.
Returns:

The preset pattern.

Return type:

pymetawear.mbientlab.metawear.peripheral.Led.Pattern

module_name

Get module name.

Returns:The name of this module.
Return type:str
notifications(callback=None)[source]

No subscriptions possible for LED module.

Raises:PyMetaWearException
pause()[source]

Pause any playing LED pattern.

play()[source]

Executes any stored LED pattern.

stop()[source]

Stop any playing LED pattern.

stop_and_clear()[source]

Stop any playing LED pattern. and clears all pattern cofigurations.

write_pattern(pattern, color)[source]

Writes the led pattern to the board.

Parameters:
  • pattern (Led.Pattern) – The pattern to write to board.
  • color (str) – g, b or ‘r’