Pages: [1]   Go Down
Author Topic: How to read a USB joystick plugged into the native USB port?  (Read 1312 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi, I'm new to Arduino programming, but I'm having trouble reading from the USB native port on my Arduino DUE board.

I have a Cyborg PC Flight Stick v1 usb joystick connected to the native USB port on my DUE and I cannot detect any input from the joystick.

The program is as follows:
Code:
void setup() {
  // initialize serial:
  Serial.begin(9600);
  SerialUSB.begin(9600);
}

void loop() {
  // if there's any serial available, read it:
  while (SerialUSB.available() > 0) {
    Serial.println(SerialUSB.read());
    }
}


I can't seem to find any info on the SerialUSB class.
What am I doing wrong?  Any help would be appreciated! 
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You need to have a library for reading data from a USB joystick with your Arduino. For instance you could try

http://airspayce.com/mikem/arduino/USBJoystick.

« Last Edit: June 27, 2013, 05:46:02 pm by AlfredJingle » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hey Alfred,
Thank-you for your suggestion.  I will definitely give that a try. 

Logged

Germany
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I am trying the same thing. I made it work about 10 minutes ago by "porting" parts of the USB Host Shield 2 stack. It's basically renaming "USB" class usages into USBHost as well as renaming quite a few uint8_t into uint32_t in the virtual methods.

I will do a clean port of it again and wrap it up as a library. If time allows I'll also write a short readme on how to port host shield stack drivers to the Due.
Logged

Forum Administrator
Milano, Italy
Offline Offline
Sr. Member
*****
Karma: 23
Posts: 292
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

@rabinath,

can you publish your code, even if its not yet finished?

C
Logged

C.

Offline Offline
Jr. Member
**
Karma: 0
Posts: 50
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Any News about it?
Logged

Pages: [1]   Go Up
Jump to: