Odd leonardo keyboard problem

Whenever I use my Leonardo as a keyboard, it has issues with the shift key. Mainly, this is my code.

void setup()
{
  Keyboard.begin();
}
void loop()
{
  Keyboard.press(0x64);
  delay(100);
  Keyboard.release(0x64);
}

It should type a "d" over and over. However, it types "D" over and over. Also, even when I unplug the Arduino, the key is still pressed. Can anyone help me?

even when I unplug the Arduino, the key is still pressed. Can anyone help me?

That is because you have to unplug it in the time between the release and the press, which is very very short. Insert a delay just before the end of the loop.

Yes, but why is the shift key pressed at all? I didn't command that.

but why is the shift key pressed at all?

It isn't, you are sending 0x64 directly into the keyboard buffer. This is a lower case d, and that is what I get when I run your code.

If you get an uppercase D then there must be some modifier that your software is taking from your other keyboard.

This is the code I used:-

void setup()
{
  Keyboard.begin();
  digitalWrite(7,HIGH); // enable pullups on pin 7
  while(digitalRead(7) == HIGH) { } // do nothing until pin 7 is pulled low
}
void loop()
{
  Keyboard.press(0x64);
  delay(100);
  Keyboard.release(0x64);
    // delay(400);
}

The trigger in the setup is to prevent trouble downloading future sketches as advised in the release notes for the Leonardo.

Same problem persists.

DFTBA:
Same problem persists.

What did you change?

When I run your code I get lower case ds. Therefore there is nothing wrong with your code.

Your error lies not with your arduino but with the system you are feeding your arduino into.
Can you describe what you are doing. Operating system, other keyboards, application at the computer end.