Python barcode scanner serial trigger

為{幸葍}努か 提交于 2019-12-25 02:18:32

问题


I'm messing around with a Honeywell 4600 barcode scanner in python, configured as a serial device. All is well and I can read barcodes with it, but I would like to test the serial trigger option instead of pressing the trigger all the time. The manual is very brief on this feature and only states "SYN T CR" has to be written to the device to activate the serial trigger

ser.write('SYN T CR')

does not seem to do much.

Can someone point me in the right direction? Thank you!


回答1:


This happens because you coded the abstract expression written in the document as raw output data.

The document represents 3 bytes of data transmission.

'SYN' and 'CR' are the following hexadecimal numbers.
'SYN' = \x16
'CR' = \x0d or escape sequence \r

'T' is an ordinary ASCII character.
Whitespace is used to separate the data in the document, not data to send.

You should write like this. Please try it.

ser.write(b'\x16T\r')

Alternatively, perhaps even you may need to prefix it.
Send data to Honeywell Xenon 1902 barcode reader via virtual com port

In that case, please try the following transmission.

ser.write(b'\x16M\r\x16T\r')


来源:https://stackoverflow.com/questions/50807334/python-barcode-scanner-serial-trigger

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!