Show Posts
Pages: [1]
1  Products / Arduino Due / Re: Keyboard emulation on native USB is not a keyboard on: January 11, 2013, 07:30:54 am
I know that polling is a very inefficient way of programming and reacting.(Always the polling delay)
But in this case it is the game on the PC which is doing it in the polling way. I was not expecting that. 
So therefore I was puzzled and came not to the idea to use the pressed key functionality
in the Arduino Due.

I will take your advice into account when I got to program someything similar on the Arduino.

Thanks a lot
2  Products / Arduino Due / Re: Keyboard emulation on native USB is not a keyboard on: January 10, 2013, 06:22:37 am
Yes, yes, yes. It works!!!
We are very grateful. TransWarp, you saved the project!!!

But please explain what the exact difference is between sending a character
and keep it pressed for the game.
I can imaging that, when the game is just polling every x miliseconds that
it is missing characters which are sent at 9600baud (~1ms)

So I tried to determ x. And below a delay(25); it started to fail once a while (the lower the more of course)
tnx again
3  Products / Arduino Due / Re: Keyboard emulation on native USB is not a keyboard on: January 09, 2013, 07:00:08 am
Hi Transwarp,

I am not aware of the above used usb instructions.

I use a very simplified piece of code with the keyboard.xxxx instructions defined for the Arduino Due:
//  Arduino code example modified to test game interface
//  With the Arduino Due Native USB
// A breadboard with a push button, just temporarily touch pin D22 to +3V3 to toggle the input

// Make sure to open a blank Notepad window or similar to avoid messing up your sketch!

 Keyboard Button test
 Sends a character 'n' when a button is pressed.
 The circuit:
 - pushbutton attached from pin 22 with resistor of 1k to 3V3
 created 24 Dec 2012
 by Yougo

const int buttonPin = 22;          // input pin for pushbutton
int previousButtonState = HIGH;    // for checking the state of a pushButton

void setup()
  // make the pushButton pin an input:
  pinMode(buttonPin, INPUT);
  Serial.println("Hello World");


void loop() {
  // Read pin22
  int buttonState = digitalRead(buttonPin);
  // if the button state has changed,
  if ((buttonState != previousButtonState) && (buttonState == HIGH))    // and it's currently pressed:
    {  Keyboard.write(110);                // type "n"
  // save the current button state for comparison next time:
  previousButtonState = buttonState;

4  Products / Arduino Due / Keyboard emulation on native USB is not a keyboard on: January 08, 2013, 05:06:58 pm

For our thesis we are working with an Arduino Due. We bought it especially for the 2nd USB port which can emulate a keyboard.
The intention was to take over the characters sent by a keyboard towards a game on PC. Instead of playing the game on the keyboard
the Arduino should collect data from other devices (like potmeters and switches) and sent the proper characters towards the game.

Unfortunally our game does not recognize the Native USB interface as a full compliant keyboard.
However other programs are accepting fine the characters sent by the Arduino Due.

I don't know that much of an USB interface but with USBlyzer I managed to detect some differences.
My keyboard has 2 interfaces (keyboard and Mouse)
The binterfaceClass/binterfaceSubClass/binterfaceProtocol is keyboard: 03_01_01 and mouse 03_01_02

For the native USB interface however, I see it is defined as a CDC device with 4 pipes. (??)
The last "Interface Descriptor" has a similar binterfaceClass/binterfaceSubClass/binterfaceProtocol : 03_00_00.
The others are CDC descriptors.(Communication Device Class)

Does anyone has a solution or a workaround for this problem?

5  Products / Arduino Due / Re: Due not sending keypresses on: January 08, 2013, 07:15:38 am
I have encountered something similar.
Are you using a non-QWERTY keyboard? It seems that the characters are converted in your PC, depending on the programmed country.
I am struggling with an AZERTY keyboard and the figures are scrambled with the lower-case characters on my keyboard.
Also the opposite is true. When sending "Keyboard.println(")!@#$%^&*(");" I see nicely 0123456789 on the screen (in a wordpad window!)
Pages: [1]