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

NAME

Tinkerforge::BrickletHallEffect - Detects presence of magnetic field

CONSTANTS

DEVICE_IDENTIFIER

This constant is used to identify a Hall Effect 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 Hall Effect Bricklet.

CALLBACK_EDGE_COUNT

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

FUNCTION_GET_VALUE

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

FUNCTION_GET_EDGE_COUNT

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

FUNCTION_SET_EDGE_COUNT_CONFIG

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

FUNCTION_GET_EDGE_COUNT_CONFIG

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

FUNCTION_SET_EDGE_INTERRUPT

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

FUNCTION_GET_EDGE_INTERRUPT

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

FUNCTION_SET_EDGE_COUNT_CALLBACK_PERIOD

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

FUNCTION_GET_EDGE_COUNT_CALLBACK_PERIOD

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

FUNCTION_EDGE_INTERRUPT

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*.

get_value()

Returns *true* if a magnetic field of 3.5 millitesla or greater is detected.

get_edge_count()

Returns the current value of the edge counter. You can configure edge type (rising, falling, both) that is counted with :func:`Set Edge Count Config`.

If you set the reset counter to *true*, the count is set back to 0 directly after it is read.

set_edge_count_config()

The edge type parameter configures if rising edges, falling edges or both are counted. Possible edge types are:

* 0 = rising * 1 = falling * 2 = both

A magnetic field of 3.5 millitesla or greater causes a falling edge and a magnetic field of 2.5 millitesla or smaller causes a rising edge.

If a magnet comes near the Bricklet the signal goes low (falling edge), if a magnet is removed from the vicinity the signal goes high (rising edge).

Configuring an edge counter resets its value to 0.

If you don't know what any of this means, just leave it at default. The default configuration is very likely OK for you.

get_edge_count_config()

Returns the edge type and debounce time as set by :func:`Set Edge Count Config`.

set_edge_interrupt()

Sets the number of edges until an interrupt is invoked.

If *edges* is set to n, an interrupt is invoked for every n-th detected edge.

If *edges* is set to 0, the interrupt is disabled.

get_edge_interrupt()

Returns the edges as set by :func:`Set Edge Interrupt`.

set_edge_count_callback_period()

Sets the period with which the :cb:`Edge Count` callback is triggered periodically. A value of 0 turns the callback off.

The :cb:`Edge Count` callback is only triggered if the edge count has changed since the last triggering.

get_edge_count_callback_period()

Returns the period as set by :func:`Set Edge Count Callback Period`.

edge_interrupt()

This callback is triggered every n-th count, as configured with :func:`Set Edge Interrupt`. The parameters are the current count and the current value (see :func:`Get Value` and :func:`Get Edge Count`).

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', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port). A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at position 'z'.

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