Mohamed Sayed
Mohamed Sayed

Reputation: 25

Send a number on USB port using Arduino

Any thoughts or helpful codes idea to program an arduino board to send a number on USB once a push button is being pressed .. so that a C++ or VB6 application can read the number from the USB port and do some task ?

The idea in a more clarified way is that I want to connect a matrix of push buttons with arduino board ( as inputs ), once a button is pressed then the arduino sends the number of the button which is numbered in the matrix as :

1 2 3 4
5 6 7 8
9 . . . 

Code sample

int inputOne = 1;  // as an example
int inputTwo = 2;

void loop()
{
If DigitalRead(inputOne, HIGH) {
 USB to send number "1"
}

If DigitalRead(inputTwo, HIGH) {
 USB to send number "2" 
}
}

So how to send a number on USB port so that a C++ or VB6 application can read it into variable or string ..

Upvotes: 0

Views: 191

Answers (1)

djUniversal
djUniversal

Reputation: 624

An Arduino Due can be used with the USBHost library which will allow you to do this very easily. It will mimic a keyboard or mouse.

http://arduino.cc/en/Reference/USBHost

Then you could create a button array with a PISO shift register or use the MANY breakouts on the Due to drive it.

Upvotes: 0

Related Questions