Python module for the SparkFun 2D Barcode Scanner Breakout - DE2120.
This python package is a port of the existing SparkFun DE2120 Arduino Library
The Qwiic Button Python package current supports the following platforms:
This driver package depends on the pyserial package.
The SparkFun 2D Barcode Scanner Breakout module documentation is hosted at ReadTheDocs
This repository is hosted on PyPi as the de2120-barcode-scanner 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 de2120-barcode-scannerFor the current user:
pip install de2120-barcode-scannerTo install, make sure the setuptools package is installed on the system.
Direct installation at the command line:
python setup.py installTo build a package for use with pip:
python setup.py sdistA package file is built and placed in a subdirectory called dist. This package file can be installed using pip.
cd dist
pip install de2120-barcode-scanner-<version>.tar.gzSee the examples directory for more detailed use examples.
from __future__ import print_function
import de2120_barcode_scanner
import time
import sys
def run_example():
print("\nSparkFun DE2120 Barcode Scanner Breakout Example 1")
my_scanner = de2120_barcode_scanner.DE2120BarcodeScanner()
if my_scanner.begin() == False:
print("\nThe Barcode Scanner module isn't connected correctly to the system. Please check wiring", \
file=sys.stderr)
return
print("\nScanner ready!")
scan_buffer = ""
while True:
scan_buffer = my_scanner.read_barcode()
if scan_buffer:
print("\nCode found: " + str(scan_buffer))
scan_buffer = ""
time.sleep(0.02)
if __name__ == '__main__':
try:
run_example()
except(KeyboardInterrupt, SystemExit) as exErr:
print("\nEnding Example 1")
sys.exit(0)


