Barcode reader

Hello all,

My project is where I need to interface a bar code reader with a mega2560. I have the option to use either a
PS2 or a USB device. My question is, can I use the Keyboard Library to read data from the scanner ?. Is yes, then what is the method to store this value in a variable, since I'll be checking it against a set value.
One more question is, if I use a USB based scanner, then I know I'd have to use a USB Host Shield, but will I have to make too many changes to the earlier program to adapt to the USB addition ?

The keyboard program I'm referring to is :
http://www.pjrc.com/teensy/td_libs_PS2Keyboard.html

Hi,

Which barcode scanner are you using?

Geoff

I'm not sure yet...a motorola one, with an rs232 o/p

My question is, can I use the Keyboard Library to read data from the scanner ?

Probably not. The only Keyboard library I know of makes the Leonardo act like a keyboard. A keyboard is an output device, not an input device.

There are also those firmware update for the usb on uno but regardless that's only going to be helpful if the scanner can emulate keyboard input surely?

Well, I've decided I'll be using the Ethernet shield to connect to the scanner. My friend said that the Ethernet o/p on the scanner fires packets of data at an IP. Is it okay to switch to ethernet ?, also remember that the scanner can ship an RS232 option too. PS/2 is outdated.

Which do you think is easier, serial or Ethernet ?

vikramnayak:
Which do you think is easier, serial or Ethernet ?

I think it's a coin toss between them. Ethernet could be more complex if you were starting with bare tin, but with the well documented libraries and examples available for Arduino networking support I think that evens it out quite a bit. Once you get the hang of that, ethernet is a solid standard whereas there can be some timing tricks to serial.

I think you could make a strong case either way.

Good luck with your project !
Geoff

Oh thanks, I may go for the Ethernet.