jacdac.magnetic_field_level

Submodules

Package Contents

Classes

MagneticFieldLevelClient

A sensor that measures strength and polarity of magnetic field.

class jacdac.magnetic_field_level.MagneticFieldLevelClient(bus: jacdac.bus.Bus, role: str, *, missing_strength_value: float | None = None)

Bases: jacdac.bus.SensorClient

A sensor that measures strength and polarity of magnetic field. Implements a client for the Magnetic field level service.

property strength: float | None

Indicates the strength of magnetic field between -1 and 1. When no magnet is present the value should be around 0. For analog sensors, when the north pole of the magnet is on top of the module and closer than south pole, then the value should be positive. For digital sensors, the value should either 0 or 1, regardless of polarity., _: /

property variant: jacdac.magnetic_field_level.constants.MagneticFieldLevelVariant | None

(Optional) Determines which magnetic poles the sensor can detected, and whether or not it can measure their strength or just presence.,

on_active(handler: jacdac.bus.EventHandlerFn) jacdac.bus.UnsubscribeFn

Emitted when strong-enough magnetic field is detected.

on_inactive(handler: jacdac.bus.EventHandlerFn) jacdac.bus.UnsubscribeFn

Emitted when strong-enough magnetic field is no longer detected.