platypush.plugins.gpio.sensor.motion.pwm3901

class platypush.plugins.gpio.sensor.motion.pwm3901.GpioSensorMotionPwm3901Plugin(rotation=0, spi_slot='front', spi_port=0, **kwargs)[source]

Plugin to interact with an PWM3901 optical flow and motion sensor

Requires:

  • pwm3901 (pip install pwm3901)
__init__(rotation=0, spi_slot='front', spi_port=0, **kwargs)[source]
Parameters:
  • rotation (int) – Rotation angle for the captured optical flow. Possible options: 0, 90, 180, 270 (default: 0)
  • spi_slot (int) – SPI slot where the sensor is connected if you’re using a Breakout Garden interface. Possible options: ‘front’, ‘back’ (default: ‘front’)
  • spi_port – SPI port (default: 0)
get_measurement()[source]
Returns:dict. Example:
output = {
    "motion_x": 3,   # Detected motion vector X-coord
    "motion_y": 4,   # Detected motion vector Y-coord
    "motion_mod": 5  # Detected motion vector module
    "motion_events_per_sec": 7  # Number of motion events detected in the last second
}
class platypush.plugins.gpio.sensor.motion.pwm3901.Rotation[source]

An enumeration.

class platypush.plugins.gpio.sensor.motion.pwm3901.SPISlot[source]

An enumeration.