Barcode scanner

Post

Posted
Rating:
#1 (In Topic #813)
Avatar
Administrator
gbWilly is in the usergroup ‘unknown’
Hi you all,

I'm currently trying to figure out how to make an application to scan barcodes.
I have a USB barcode scanner to scan the barcodes.

I have been searching this forum and other places (like wiki) to figure out how to get this done but nothing was really helpful.

I presume I need to use SerialPort to get this done but I get stuck at something simple as:

Code (gambas)

  1. DIM BarCodeScanner AS NEW SerialPort
  2.  
  3. BarCodeScanner.PortName = ????

How do I know the portname, I have no idea.
It would also be nice to have some sample code that I can study to get a grasp on how this works.
It is probably something simple I am completely overlooking…  :(  :?

gbWilly
- Gambas Dutch translator
- Gambas wiki content contributor
- Gambas debian/ubuntu package recipe contributor
- GambOS, a distro for learning Gambas and more…
- Gambas3 Debian/Ubuntu repositories


… there is always a Catch if things go wrong!
Online now: No Back to the top

Post

Posted
Rating:
#2
Avatar
Guru
cogier is in the usergroup ‘Guru’
 Hi gbWilly, long time no hear!

I have written barcode reading programs, but I have always used a USB reader, which is seen by the computer as a keyboard. Once the gun has read the code, it sends the text to the keyboard with a newline on the end.

Do you have no option but to use one with a serial port?
Online now: No Back to the top

Post

Posted
Rating:
#3
Regular
vuott is in the usergroup ‘Regular’

gbWilly said

Code (gambas)

  1. BarCodeScanner.PortName = ????

How do I know the portname, I have no idea.
…something similar to:
 "<COLOR color="#BF0000">/dev/ttyACM0</COLOR>"
or
 "<COLOR color="#BF0000">/dev/ttyUSB1</COLOR>"

Europaeus sum !

<COLOR color="#FF8000">Amare memorentes atque deflentes ad mortem silenter labimur.</COLOR>
Online now: No Back to the top

Post

Posted
Rating:
#4
Regular
Diverod is in the usergroup ‘Regular’
I used to just monitor a TextBox for keyboard entry, something like this:

Code (gambas)

  1. Private Sub txbBarCodeInput_KeyPress()
  2.  
  3.   If Chr(13) Then   ' This is the last non-text character from BCreader
  4.     ' Put Code here
  5.      
This is just from memory but hopefully will give you an idea to work from. Make sure the TextBox has focus so it will receive keyboard input.
Online now: No Back to the top

Post

Posted
Rating:
#5
Avatar
Administrator
gbWilly is in the usergroup ‘unknown’

cogier said

Hi gbWilly, long time no hear!

I have written barcode reading programs, but I have always used a USB reader, which is seen by the computer as a keyboard. Once the gun has read the code, it sends the text to the keyboard with a newline on the end.
Hi Cogier,

I am using a USB reader and reading your and the other comments I understand that it is more simple than I could imagine.
The Universal Serial Bus made me think I needed SerialPort for some reason, that's where I went wrong. :?
Luckily, no need to use SerialPort. It is all so much simpler than I imagined.

If I get it right it's just getting the focus on a TextBox, scan with USB scanner and the barcode should be in the TextBox.

So I guess it's playtime  ;)

gbWilly
- Gambas Dutch translator
- Gambas wiki content contributor
- Gambas debian/ubuntu package recipe contributor
- GambOS, a distro for learning Gambas and more…
- Gambas3 Debian/Ubuntu repositories


… there is always a Catch if things go wrong!
Online now: No Back to the top

Post

Posted
Rating:
#6
Avatar
Administrator
gbWilly is in the usergroup ‘unknown’

Diverod said

I used to just monitor a TextBox for keyboard entry, something like this:

Code (gambas)

  1. Private Sub txbBarCodeInput_KeyPress()
  2.  
  3.   If Chr(13) Then   ' This is the last non-text character from BCreader
  4.     ' Put Code here
  5.      
This is just from memory but hopefully will give you an idea to work from. Make sure the TextBox has focus so it will receive keyboard input.

Thanks Diverod,

You remembered correctly, your code works as a charm.
It is so simple if you know where to look…  :D

Thanks

gbWilly
- Gambas Dutch translator
- Gambas wiki content contributor
- Gambas debian/ubuntu package recipe contributor
- GambOS, a distro for learning Gambas and more…
- Gambas3 Debian/Ubuntu repositories


… there is always a Catch if things go wrong!
Online now: No Back to the top
1 guest and 0 members have just viewed this.