I have an arduino with usb host shield, scope of that is to use a usb HID of a device.
To check the connection I used some sw from circuits@home group and works fine.
My problem, due to the fact that I'm a basic programmer, is that I don't know how to send a hex string from arduino to the devices.
Is there an easy code that allow me to understand how to send (why not, to receive) messages from to usb hid interface with a little explainations?
Thank you in advance.
First thing you need to do is define what you mean be “a hex string”. Frankly, it is unlikely that you need to send a string of hex digits to anything.
I have an arduino with usb host shield
due to the fact that I’m a basic programmer
These two statements do NOT go together!
I have a meteo weather station that could share the data through hid usb. To obtain this informations is necessary to sent this string in hex 20 00 08 01 00 00 00 00.
My target is to send it and read what will be put in answer on the usb.
Thank you in advance.
To obtain this informations is necessary to sent this string in hex 20 00 08 01 00 00 00 00.
Prove it! Post a link to some documentation that says that the device expects a string.
An array of bytes is NOT a string.
I have to prove nohting, if you have someting that could help me please post, otherwise forget.
if you have someting that could help me please post, otherwise forget.
PaulS has already given you the best advice there is.
You have probably misunderstood the interface specification. This is easily done and particularly likely given the inexperience you mention and the ambiguous way you describe the problem. If you check the interface specification and confirm you're right and the interface really does use an ascii encoded hex messaging format as you described, then it should be easy enough for you to demonstrate that by posting a link to or extract from the relevant spec so that we can see for certain what you need. In the absence of that I'll assume that you've just misunderstood. You don't have to prove me wrong - unless you want help solving the problem.
Unfortunately on that interface there aren't many informations available. The only things that I have found are here http://www.dg1sfj.de/hardware/hw_wmr100_protokoll.html.
Personally I have logged the traffic with a usb spy sw when that interface is connected to a pc with a dedicated sw, confirming what is described on the site.
On spy sw that messages is type URB and the raw data is exactly the sequence that I have wrote before.
Anyway if more tec infos are needed please suggest me what is needed and if is possible obtain with particular pc sw for example, for a detailed logs.