I try to send a slash
I tried / ----> Displays a minus sign
I tried ASCII: Keyboard.write(0x2f); ----> Displays also minus sign
I tried Keyboard.write(//check); display two minus
When you say you checked it on Windows and Mac, do you mean you just ran a standard serial communications program, displaying characters received on the serial port?
I suspect the systems you are using are expecting a German keyboard. The Arduino library uses the US English key codes. When you say '/' it used the US English keycode 0x38 (?/). On that key the German keyboard has (_-). On a German keyboard you would use Shift-7 to get a slash. On the US English keyboard that would get you a '&'. Just put an '&' where you want to send '/'.
Or you could edit the hardware/arduino/avr/cores/arduino/HID.cpp file to change the ASCII->keycode mapping for a German keyboard.
mariomueller:
sorry. But did you think why i did cross-posting?
a) first post was a german forum
b) I did not receive an answer there
Sorry, but you are lying.
Not very nice of you.
You received the top answer with reply #1:
And that's totally right what user 'combie' wrote.
You are sending keyboard scancodes for the US layout of the keyboard, and you don't have something like a "German keyboard driver loaded" in your Arduino sketch.
What you are trying to do is using the US keyboard layout:
And now have a look where the slash is in the US keyboard layout and what character is in the same position on your German keyboard!
If you don't understand answers in the German forum, you are allowed to request further expanations.
Instead: You replied nothing to any answer you got in the German forum. Not a "thank you" and not "I don't understand". Nothing! You created a new thread in the German forum. You got a correct answer. And you were never seen again in that thread of the German forum.
sorry.
Yes it is true. There was an answer in the german forum; but this did not work. So i had better written; there was no sattisfiing answer. At least it is the same
I also tried ascii; which also didn't work.
And I wonder what people are here in the forum?
one is getting mad, because I was cross posting; oh, what a tragedy. The world is going under
a) first post was a german forum
b) I did not receive an answer there
What is false there . If you want arduino to become popular, you shouldn't give answers like yours. This is not good for the acceptance of arduino.
Cross-posting is cross-posting. Doing it in different languages does not change that. If you post in German, Spanish, English, French and Swahili that is cross-posting. You are trying to increase the chance of a reply.
It is like people cross-posting in Programming, Electronics, Sensors, and Problem Solving. Same thing.
If you want arduino to become popular, you shouldn't give answers like yours.
I don't want people who work hard answering questions to have to answer them twice because of cross-posters. Like it leave it.
b) I did not receive an answer there
You did get an answer, which I referred to above. The question was, why are you getting strange characters when you use the keyboard class. The suggested answer was different keyboard layouts, which I thought could be correct.
I have never tried using the Keyboard class, but you don't seem to ever call Keyboard.begin() in your setup. Here's some sample code from the class description.
void setup() {
// make pin 2 an input and turn on the
// pullup resistor so it goes high unless
// connected to ground:
pinMode(2, INPUT_PULLUP);
Keyboard.begin();
}
void loop() {
//if the button is pressed
if(digitalRead(2)==LOW){
//Send the message
Keyboard.print("Hello!");
}
}
[code]
ps: This is why it is important to always post the entire sketch.
mariomueller:
Hi johnwasser,
yes, I tried ASCII: Keyboard.write(0x2f);
That is equivalent to saying Keyboard.write('/'); which we know doesn't work because the US English keycode for '/' is the German keycode for '-'. Try Keyboard.write(0x26); or Keyboard.write('&');. That should get you the German keycode for '/'.