Marc Brigham
Marc Brigham

Reputation: 2264

Reading incoming data from barcode

I have to read incoming data from a barcode scanner using pyserial. Then I have to store the contents into a MySQL database. I have the database part but not the serial part. can someone show me examples of how to do this. I'm using a windows machine.

Upvotes: 1

Views: 1208

Answers (1)

Ian
Ian

Reputation: 2021

You will find it easier to use a USB scanner. These will decode the scan, and send it as if it were typed on the keyboard, and entered with a trailing return.

The barcode is typically written with leading and trailing * characters, but these are not sent with the scan.

Thus you print "*AB123*" using a 3 of 9 font, and when it is scanned sys.stdin.readline().stript() will return "AB123".

There are more than a few options that can be set in the scanner, so you need to read the manual. I have shown the factory default above for a cheap nameless scanner I bought from Amazon.

Upvotes: 1

Related Questions