Hello, i want ask a programming question but not for the arduino itself.
I have an arduino Leonardo and i have to make a fuction which they will send data to Arduino Leonardo from a USB port.
I have to use libusb, but i have never used libusb and i don't know it. So i would like first of all to ask if there is anybody who can help me with this.
You don't have to use libusb to communicate with Leonardo.
You can use the USB CDC class so it looks like serial port to the application on
the host.
It is much easier than using libusb to send/receive usb bulk block messages.
I Googled LIBUSB64Fix.zip and got "About 2,540 results" which doesn't narrow it down very much.
This is for a uni project and my teacher asked me to use it so....
Well, good luck with that.
I presume your "teacher" expects you to do the work yourself, or are you on a business course where the outcome is to get someone else to do it for you?
Have you tried reading the documentation for libusb?
If you tell us what it is you actually want to achieve we may be in a better position to help you out. As it is, we have even less of a clue than you do.
You want to make a function? Ok, here's a function:
int myHappyFunction(int z) {
int x = 43;
int y = 2993;
return (x + c) * (y/c);
}
And here's sending some data over USB:
Serial.println("Hello USB port. I am some serial data sent over you!");
[code]
Now, none of those answer your question in the slightest - just in the same way that you haven't answered our questions.
mdimiou:
I want to make function.... and i want to send some data from a usb port.
Do you mean that you want to write a function for a program that runs on a PC so that the PC can communicate with a Leonardo over a USB connection?
If not, what computer will be running the function that uses Libusb?
You are not providing us with sufficient information for anyone to be able to give you good advice.
Your question is a bit like "I have to use a Honda engine, how do I get to San Francisco?"
...R
Ohh yeap, i want to do this.... So lets take it from the start
There is already made a code by my teacher which is running on a PC.
I have to make some functions for this program and in there i have to send some data to Arduino through USB.
I am using windows 7 and i have dev c++ and Visual studio 2010 express.
mdimiou:
There is already made a code by my teacher which is running on a PC.
I have to make some functions for this program and in there i have to send some data to Arduino through USB.
I am using windows 7 and i have dev c++ and Visual studio 2010 express.
That makes things a good bit clearer. Pity it's taken a whole page to get to to the question
Sorry, I have long since forgotten Windows programming so I can't give specific help. To be honest I didn't even know libusb works on Windows.
I think it would help people to help you if you give us an outline of each of the functions you want to make. What input paramters they will receive and what outputs they are expected to produce.
mdimiou:
These functions won't have any input parameters.
It will still help if you provide an outline of each of the proposed functions - perhaps using pseudo code. For example (based on Arduino style code)
void function1() {
// send "this is a test from function1;
}
void function2() {
// send "this is a test from function2;
}
I presume you have access to the libusb API so you can make an attempt to write the functions in proper code. The more work you do on this the easier it will be for people to give you some help. At the moment your question is not far from "Please write the code for me"
How will the existing code call the functions you are hoping to create?
Maybe there is another Forum tha can give advice on libusb. The Python code in the example attached to Reply #4 of this Thread illustrates the principle of communicating between a PC and an Arduino. It shouldn't be too difficult to convert the Pythong code to C++.
basically no..... i don't want from anyone to write code for me..... i just don't know libusb at all.... i try to search for examples and learn about USB programming... this is what i need here....
how i can open a USB PORT, what i have to look more carefully......
But not... i don't want someone to do work for me...!!!