Qwiic_OTOS_Py
Python for SFE Qwiic OTOS
Loading...
Searching...
No Matches
Qwiic_OTOS_Py



follow on Twitter

SparkFun Optical Tracking Odometry Sensor - PAA5160E1 (Qwiic)

Python module for the SparkFun Optical Tracking Odometry Sensor - PAA5160E1 (Qwiic)

This python package is a port of the existing SparkFun Optical Tracking Odometry Sensor Arduino Library.

This package can be used in conjunction with the overall SparkFun qwiic Python Package. New to qwiic? Take a look at the entire SparkFun Qwiic ecosystem.

⚠ <strong>Using this sensor on a Raspberry Pi</strong>? ⚠

Your system might need modification. See this note.

Contents

  • Supported Platforms
  • Dependencies
  • Installation
  • Documentation
  • Example Use

Supported Platforms

The qwiic otos Python package current supports the following platforms:

Dependencies

This driver package depends on the qwiic I2C driver: Qwiic_I2C_Py

Documentation

The SparkFun qwiic otos module documentation is hosted at ReadTheDocs

Installation

PyPi Installation

This repository is hosted on PyPi as the sparkfun-qwiic-otos package. On systems that support PyPi installation via pip, this library is installed using the following commands

For all users (note: the user must have sudo privileges):

sudo pip install sparkfun-qwiic-otos

For the current user:

pip install sparkfun-qwiic-otos

To install, make sure the setuptools package is installed on the system.

Direct installation at the command line:

python setup.py install

To build a package for use with pip:

python setup.py sdist

A package file is built and placed in a subdirectory called dist. This package file can be installed using pip.

cd dist
pip install sparkfun_qwiic_otos-<version>.tar.gz

Raspberry Pi Use

For this sensor to work on the Raspberry Pi, I2C clock stretching must be enabled.

To do this:

  • Login as root to the target Raspberry Pi
  • Open the file /boot/config.txt in your favorite editor (vi, nano ...etc)
  • Scroll down until the block that contains the following is found:
    dtparam=i2c_arm=on
    dtparam=i2s=on
    dtparam=spi=on
  • Add the following line:
    # Enable I2C clock stretching
    dtparam=i2c_arm_baudrate=10000
  • Save the file
  • Reboot the raspberry pi

Example Use

See the examples directory for more detailed use examples.

from __future__ import print_function
import qwiic_otos
import sys
import time
def runExample():
print("\nQwiic otos Example 1 - Buzz\n")
# Create instance of device
my_otos = qwiic_otos.Qwiicotos()
# Initialize the device
if my_otos.begin() == False:
print("The device isn't connected to the system. Please check your connection", \
file=sys.stderr)
return
print("\nQwiic otos ready!")
# Loop forever
while True:
my_otos.on()
time.sleep(1)
my_otos.off()
time.sleep(1)
if __name__ == '__main__':
try:
runExample()
except (KeyboardInterrupt, SystemExit) as exErr:
print("\nEnding Example")
sys.exit(0)

SparkFun - Start Something