How to control external device through usb port
Afficher commentaires plus anciens
i am doing an automatic numberplate recognition system for acces control, i want to interface a motor controlled barrier, which will be triggered by a command to the usb port of the computer if a particular plate is recognised in a database and is allowed in. what commands can i use to trigger the external device? #clueless!
Réponses (1)
Image Analyst
le 5 Avr 2014
0 votes
Model of what ? What is the "external device" ? Is it a camera? A bar code reader? And what is the "(toy) boom" you're going to attach to it? Do you mean boom like a loud sound (like your toy explodes) or a boom like a movable horizontal arm used for hanging things? Do you want a camera (the device) to read the license plate number off a toy car, and then look it up in a database, and if the car is authorized, to lift a a crossing guard arm (the boom) to let the car proceed to drive forward? Just a guess since I can't figure out what you're trying to say.
6 commentaires
Nakk Mungofa
le 5 Avr 2014
Image Analyst
le 5 Avr 2014
Modifié(e) : Image Analyst
le 5 Avr 2014
Yes you can. If your arm-lifting device has a DLL for it, then you can call loadlibrary() and call functions in that DLL. I talk to Measurement Computing Devices, which are attached to a USB port, with their DLL. For example see the attache code where I read a switch closure attached to the MCC device.
P.S. I know it looks scary at first glance but take a deep breath and just take it a line at a time. It's very well commented so you should be able to handle it.
Nakk Mungofa
le 6 Avr 2014
Nakk Mungofa
le 7 Avr 2014
Image Analyst
le 7 Avr 2014
Nakk, obviously unless you have the same device I have, the code won't work for you. Your device is almost certainly different. You'll have a different DLL. My code is just an example of how it is done. Obviously you'll have to make modifications for your device.
An RS232 is probably not easier. In fact since computers don't come with those kinds of ports anymore you'll have to get an USB to RS232 converter and install some software, which can be done (and I have done it), but why bother since you have a USB device?
Nakk Mungofa
le 20 Avr 2014
Catégories
En savoir plus sur C2000 Microcontroller Blockset dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!