Skip to main content

Introduction

Documentation Status Discord Build Status Code Style: Ruff

A CircuitPython/Python library for Benewake’s TF mini distance sensor

Dependencies

This driver depends on:

Please ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloading the Adafruit library and driver bundle.

Installing from PyPI

On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally from PyPI. To install for current user:

pip3 install adafruit-circuitpython-tfmini

To install system-wide (this may be required in some cases):

sudo pip3 install adafruit-circuitpython-tfmini

To install in a virtual environment in your current project:

mkdir project-name && cd project-name
python3 -m venv .venv
source .venv/bin/activate
pip3 install adafruit-circuitpython-tfmini

Usage Example

import time
import board  # comment this out if using pyserial
import busio  # comment this out if using pyserial
import adafruit_tfmini

# Use hardware uart
uart = busio.UART(board.TX, board.RX)

# Or, you can use pyserial on any computer
#import serial
#uart = serial.Serial("/dev/ttyS2", timeout=1)

# Simplest use, connect with the uart bus object
tfmini = adafruit_tfmini.TFmini(uart)

# You can put in 'short' or 'long' distance mode
tfmini.mode = adafruit_tfmini.MODE_SHORT
print("Now in mode", tfmini.mode)

while True:
    print("Distance: %d cm (strength %d, mode %x)" %
          (tfmini.distance, tfmini.strength, tfmini.mode))
    time.sleep(0.1)

Documentation

API documentation for this library can be found on Read the Docs.

For information on building library documentation, please check out this guide.

Contributing

Contributions are welcome! Please read our Code of Conduct before contributing to help this project stay welcoming.

Metadata

Release files for adafruit-circuitpython-tfmini 1.2.25

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for adafruit-circuitpython-tfmini 1.2.25
File Size Uploaded
adafruit_circuitpython_tfmini-1.2.25.tar.gz 23.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for adafruit-circuitpython-tfmini 1.2.25
File Interpreter ABI Platform
adafruit_circuitpython_tfmini-1.2.25-py3-none-any.whl Python 3 none any Details

Total release size: 28.7 kB

Release files / adafruit_circuitpython_tfmini-1.2.25.tar.gz

Download URL adafruit_circuitpython_tfmini-1.2.25.tar.gz
Size 23.3 kB
Tags Source
SHA-256 checksum
How to use checksums
b546110e0a22bd671871a158c725e87ac51bebb1e9a81e8d2b4438600c554ed9
BLAKE2b-256 checksum
How to use checksums
0b01568b2900e17c64123f347f1cbe827d7f2153ff9662b0b356afe6ed93ceca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

Release files / adafruit_circuitpython_tfmini-1.2.25-py3-none-any.whl

Download URL adafruit_circuitpython_tfmini-1.2.25-py3-none-any.whl
Size 5.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
862ea50ece7f25857f05af8cbc9ed465cf9707253d4202f20aa47e0cde30fbd3
BLAKE2b-256 checksum
How to use checksums
1a4a5b6e26d45d4020e4a9198e68d1e697cd983e5b455e8255695721c0c57b9f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

Release history Release notifications | RSS feed

This release

1.2.25 This release

2 release files

1.2.24

2 release files

1.2.23

2 release files

1.2.22

2 release files

1.2.21

2 release files

1.2.20

2 release files

1.2.17

2 release files

1.2.16

2 release files

1.2.14

2 release files

1.2.13

2 release files

1.2.12

2 release files

1.2.10

1 release file

1.2.9

1 release file

1.2.8

1 release file

1.2.7

1 release file

1.2.6

1 release file

1.2.5

1 release file

1.2.4

1 release file

1.2.3

1 release file

1.2.2

1 release file

1.2.1

1 release file

1.2.0

1 release file

1.1.2

1 release file

1.1.1

1 release file

1.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page