Skip to main content

Python driver for the SparkFun SPX-17979 Qwiic Sound Trigger

Project description

spx17979-driver

Python driver for the SparkFun SPX-17979 Qwiic Sound Trigger.

PyPI PyPI - License PyPI - Downloads

Installation

The package is available on PyPI. Installation is can be done with your favourite package manager. For example:

pip install spx17979-driver

Usage

In order to initialise the device we need an open SMBus object. Depending on the machine that you are running on you may need to provide another bus number or path:

from spx17979 import SPX17979
from smbus2 import SMBus


with SMBus(1) as bus:
    device = SPX17979(bus=bus)

When the device has been triggered by a sound, the trigger property will be True. It can be reset by calling the reset() method. That is it!

A simple usage example:

from time import sleep

from spx17979 import SPX17979
from smbus2 import SMBus


with SMBus(1) as bus:
    device = SPX17979(bus=bus)
    device.reset()
    
    while True:
        if device.trigger:
            print("Triggered!")
            sleep(0.5)  # Prevent triggering twice on the same sound
            device.reset()
        sleep(0.001)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

spx17979-driver-0.1.0.tar.gz (6.6 kB view hashes)

Uploaded Source

Built Distribution

spx17979_driver-0.1.0-py3-none-any.whl (7.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page