The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Tinkerforge::BrickletLEDStrip - Controls up to 320 RGB LEDs

CONSTANTS

DEVICE_IDENTIFIER

This constant is used to identify a LED Strip Bricklet.

The get_identity() subroutine and the CALLBACK_ENUMERATE callback of the IP Connection have a device_identifier parameter to specify the Brick's or Bricklet's type.

DEVICE_DISPLAY_NAME

This constant represents the display name of a LED Strip Bricklet.

CALLBACK_FRAME_RENDERED

This constant is used with the register_callback() subroutine to specify the CALLBACK_FRAME_RENDERED callback.

FUNCTION_SET_RGB_VALUES

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_GET_RGB_VALUES

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_SET_FRAME_DURATION

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_GET_FRAME_DURATION

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_GET_SUPPLY_VOLTAGE

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_SET_CLOCK_FREQUENCY

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_GET_CLOCK_FREQUENCY

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_SET_CHIP_TYPE

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_GET_CHIP_TYPE

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_GET_IDENTITY

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTIONS

new()

Creates an object with the unique device ID *uid* and adds it to the IP Connection *ipcon*.

set_rgb_values()

Sets the *rgb* values for the LEDs with the given *length* starting from *index*.

The maximum length is 16, the index goes from 0 to 319 and the rgb values have 8 bits each.

Example: If you set

* index to 5, * length to 3, * r to [255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], * g to [0, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] and * b to [0, 0, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

the LED with index 5 will be red, 6 will be green and 7 will be blue.

.. note:: Depending on the LED circuitry colors can be permuted.

The colors will be transfered to actual LEDs when the next frame duration ends, see :func:`SetFrameDuration`.

Generic approach:

* Set the frame duration to a value that represents the number of frames per second you want to achieve. * Set all of the LED colors for one frame. * Wait for the :func:`FrameRendered` callback. * Set all of the LED colors for next frame. * Wait for the :func:`FrameRendered` callback. * and so on.

This approach ensures that you can change the LED colors with a fixed frame rate.

The actual number of controllable LEDs depends on the number of free Bricklet ports. See :ref:`here <led_strip_bricklet_ram_constraints>` for more information. A call of :func:`SetRGBValues` with index + length above the bounds is ignored completely.

get_rgb_values()

Returns the rgb with the given *length* starting from the given *index*.

The values are the last values that were set by :func:`SetRGBValues`.

set_frame_duration()

Sets the frame duration in ms.

Example: If you want to achieve 20 frames per second, you should set the frame duration to 50ms (50ms * 20 = 1 second).

For an explanation of the general approach see :func:`SetRGBValues`.

Default value: 100ms (10 frames per second).

get_frame_duration()

Returns the frame duration in ms as set by :func:`SetFrameDuration`.

get_supply_voltage()

Returns the current supply voltage of the LEDs. The voltage is given in mV.

set_clock_frequency()

Sets the frequency of the clock in Hz. The range is 10000Hz (10kHz) up to 2000000Hz (2MHz).

The Bricklet will choose the nearest achievable frequency, which may be off by a few Hz. You can get the exact frequency that is used by calling :func:`GetClockFrequency`.

If you have problems with flickering LEDs, they may be bits flipping. You can fix this by either making the connection between the LEDs and the Bricklet shorter or by reducing the frequency.

With a decreasing frequency your maximum frames per second will decrease too.

The default value is 1.66MHz.

.. note:: The frequency in firmware version 2.0.0 is fixed at 2MHz.

.. versionadded:: 2.0.1$nbsp;(Plugin)

get_clock_frequency()

Returns the currently used clock frequency as set by :func:`SetClockFrequency`.

.. versionadded:: 2.0.1$nbsp;(Plugin)

set_chip_type()

Sets the type of the led driver chip. We currently support the chips

* WS2801 (``chip`` = 2801), * WS2811 (``chip`` = 2811) and * WS2812 (``chip`` = 2812).

The WS2812 is sometimes also called "NeoPixel", a name coined by Adafruit.

The default value is WS2801 (``chip`` = 2801).

.. versionadded:: 2.0.2$nbsp;(Plugin)

get_chip_type()

Returns the currently used chip type as set by :func:`SetChipType`.

.. versionadded:: 2.0.2$nbsp;(Plugin)

get_identity()

Returns the UID, the UID where the Bricklet is connected to, the position, the hardware and firmware version as well as the device identifier.

The position can be 'a', 'b', 'c' or 'd'.

The device identifier numbers can be found :ref:`here <device_identifier>`. |device_identifier_constant|