-1

Im having some issues reading from a barcode scanner module.. The scanner works just fine if it is used with a USB adapter, my goal is to use the RX & TX GPIO of my RPi to control it.

What I am trying to do is something similar to this:

https://www.rtscan.net/raspberry-pi-barcode-scanner/

My problem is that I am not getting any data after scanning the barcodes.

This is what I have done so far:

  1. I have the configured the ttyS0 on my RPi.
  2. I can see ttyS0 if I do ls /dev -l
  3. cat /dev/ttyS0 - opens a connection, not getting I/O error
  4. Ive scanner RX (IN) connected to RPI TX (Out)
  5. Ive scanner TX (OUT) connected to RPI RX (IN)
  6. wrote small python file to read and write info on the screen:
import serial
import time 

port = serial.Serial('/dev/ttyS0')
#port.baudrate=9600
while True:
    port.write("Say something:\n")
    rcv = port.read(10)
    port.write("rnYou sent:" + repr(rcv))
    time.sleep(0.10)

Any ideas on what I might be missing?

MrServer
  • 1
  • 2

1 Answers1

0

Thank you tlfon01, you pointed me on the right direction. I ended up solving this problem by disabling the BT, and using ttyAMA0 instead of ttyS0.

MrServer
  • 1
  • 2