When you plug in your device, you 'll want it to appear in this menu and disappear when you unplug it. This Popup Menu will automatically update to show devices that have been added or removed. The best thing to do is add a Popup Menu to your app that lists the serial devices so the user can choose one.ĭrag a Label from the Library and title it "Serial Devices:".ĭrag a Popup Menu from the Library and set the Name property of the control DevicesPopupMenu. Unfortunately, operating systems don 't provide an easy way for a typical end user to find out which devices are assigned which numbers. If you know the name the device uses, you can loop through all of the serial devices and look for the index that has the matching name. If you know the number, you can just hard-code it. Serial devices connected to a computer are identified numerically with 0 being the first device. Launch Xojo (if you haven 't already) and create a new Desktop project. You may not want to depend on that or you may be using a device that doesn 't pretend to be something else and you must communicate with it directly. That's fine for some purposes but it means the user must have the cursor in the field where they want the barcode value to appear. You scan a barcode and they convert that to a value then inserts the value into the keyboard buffer as if the user typed it. Many bar code scanners pretend to be a keyboard. This particular barcode scanner is popular and available from Amazon for about $100 new or less than $40 used. This tutorial uses a Motorola LS2208 barcode scanner but you can connect to and communicate with any serial device. What is important is that the device makes it clear that it's a serial device. There are some devices that combine these two so you don 't need the adapter. This allows your serial device to connect to your computer through USB. That means it has a connector like this:Ĭomputers no longer have RS-232 ports so you 'll also need an RS-232 to USB adapter like this: For this tutorial, the serial device must be an RS-232 device. It makes sense to first start with the serial device.
0 Comments
Leave a Reply. |