Code Monkey home page Code Monkey logo

mcr12_serial's Introduction

Introduction

This is a Python 3 module for controlling the so called "MCR12" barcode scanner module via USB serial port emulation. The MCR12 is sold as standalone module, for example on Adafruit, and it is also the module on which some barcode scanner, such as this one, are based.

Usage

from mcr12_serial import BarcodeScanner

bcd = BarcodeScanner("/path/to/serial/device", baudrate=9600)

barcode1 = bcd.scan()  # Same as bcd.scan(0)
# The scanner will start scanning indefinitely until a barcode is
# scanned.

barcode2 = bcd.scan(5000)
# The scanner will start scanning. If after 5000 milliseconds no
# barcode has been scanned, a TimeoutError is raised.

bcd.stop()
# Stop scanning. Not really useful here as the scanner stops scanning
# automatically after a barcode has been scanned or after the timeout
# has expired. However it may be useful if you call the scan() method
# asynchronously or if you need to handle a KeyboardInterrupt to stop
# scanning after calling the scan() method.

bcd.config("013300")
# Edit the scanner configuration. "013300" must be replaced with a
# configuration code.

Configuration codes

You can find configuration codes on the MCR 12 Manual. They are written under each configuration barcode.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.