Skip to content

sparkfun/Qwiic_RFID_Py

Repository files navigation

Qwiic_RFID_Py

follow on Twitter

SparkFun Qwiic RFID Reader

Python module for the SparkFun RFID Qwiic Reader

This module is also compatible with the following products:

This python package is a port of the existing SparkFun Qwiic RFID Reader 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.

Contents

Supported Platforms

The Qwiic RFID Python package current supports the following platforms:

Dependencies

This driver package depends on the qwiic I2C driver: Qwiic_I2C_Py

Documentation

The SparkFun Qwiic RFID module documentation is hosted at ReadTheDocs

Installation

PyPi Installation

This repository is hosted on PyPi as the sparkfun-qwiic-rfid 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-rfid

For the current user:

pip install sparkfun-qwiic-rfid

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-rfid-<version>.tar.gz

Example Use

See the examples directory for more detailed use examples.

from __future__ import print_function
import qwiic_rfid
import time
import sys

def run_example():

    print("\nSparkFun Qwiic RFID Reader Example 1")
    my_RFID = qwiic_rfid.Qwiic_RFID()

    if my_RFID.begin() == False:
        print("\nThe Qwiic RFID Reader isn't connected to the system. Please check your connection", file=sys.stderr)
        return
    
    print("\nReady to scan some tags!")
    
    while True:
        val = input("\nEnter 1 to get tag ID and scan time: ")

        if int(val) == 1:
            print("\nGetting your tag ID...")
            tag = my_RFID.get_tag()
            print("\nTag ID: " + tag)

            scan_time = my_RFID.get_prec_req_time()
            # If this time is too precise, try:
            # scan_time = my_RFID.get_req_time()
            print("\nScan Time: " + str(scan_time))
        
        time.sleep(0.02)

if __name__ == '__main__':
    try:
        run_example()
    except (KeyboardInterrupt, SystemExit) as exErr:
        print("\nEnding Example 1")
        sys.exit(0)

SparkFun - Start Something

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages