Arduino DUE usb magstripe controlled unit

Hello all,

Simple (i think) question. I am familiar with arduino at an intro level, not with USB or SerialUSB at all.

I have an arduino DUE, I have a magstripe card reader that is usb. It works as a keyboard, when I plug it into any computer and swipe a card, types the characters of the card in any program. I cannot get it to read in my arduino.

I plug it into the native usb port right? the one on the side of the reset button. and plug my computer into the port on the side of the power connector? I've been using the following code, I cannot get it to work with a keyboard either and I am uncertain if I need any special type of usb keyboard.

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());
    }
}

Thank you for your help.

No you need to use the USBHost class (see the DUE’s documentation).

Mark