Hallo,
inzwischen habe ich mich mit meinem Board ein wenig auseinandergesetzt, und komme eigentlich auch ganz gut klar. Mein Problem ist, dass ich zur Steuerung des Programms, wofür ich das Board als Tastatur verwenden möchte, die Taste "ESC" brauche. Das sollte nun ja kein Problem sein, denn auf der Seite von Arduino steht der Hex-Code 0xB1. Im Netz findet man 0x1B. Ich habe beide ausprobiert, und mir die Ausgabe mit einem kleinen Programm anzeigen lassen. Keiner der beiden Hex-Codes bringt die Taste "ESC". Mein Code sieht wie folgt aus:
void setup()
{
pinMode(2, INPUT); // Set the button as an input
digitalWrite(2, HIGH); // Pull the button high
pinMode(3, INPUT); // Set the button as an input
digitalWrite(3, HIGH); // Pull the button high
pinMode(4, INPUT); // Set the button as an input
digitalWrite(4, HIGH); // Pull the button high
pinMode(5, INPUT); // Set the button as an input
digitalWrite(5, HIGH); // Pull the button high
pinMode(6, INPUT); // Set the button as an input
digitalWrite(6, HIGH); // Pull the button high
pinMode(7, INPUT); // Set the button as an input
digitalWrite(7, HIGH); // Pull the button high
pinMode(8, INPUT); // Set the button as an input
digitalWrite(8, HIGH); // Pull the button high
pinMode(9, INPUT); // Set the button as an input
digitalWrite(9, HIGH); // Pull the button high
pinMode(10, INPUT); // Set the button as an input
digitalWrite(10, HIGH); // Pull the button high
}
void loop()
{
if (digitalRead(2) == 0) // if the button goes low
{
Keyboard.write(0xC7); // send a 'F6' (Flarm-Radar) to XCSoar
delay(200); // delay so there aren't a kajillion f's
}
if (digitalRead(3) == 0) // if the button goes low
{
Keyboard.write(0xC8); // send a 'F7' (Menu) to XCSoar
delay(200); // delay so there aren't a kajillion m's
}
if (digitalRead(4) == 0) // if the button goes low
{
Keyboard.write(0xC9); // send a 'F8' (Quick-Menu) to XCSoar
delay(200); // delay so there aren't a kajillion q's
}
if (digitalRead(5) == 0) // if the button goes low
{
Keyboard.write(0x1B); // send a 'ESC' (Exit) to XCSoar
delay(200); // delay so there aren't a kajillion x's
}
if (digitalRead(6) == 0) // if the button goes low
{
Keyboard.write(0xB0); // send a 'Return' to XCSoar
delay(200); // delay so there aren't a kajillion
}
if (digitalRead(7) == 0) // if the button goes low
{
Keyboard.write(0xDA); // send a 'UP-Arrow' to XCSoar
delay(200); // delay so there aren't a kajillion arrows's
}
if (digitalRead(8) == 0) // if the button goes low
{
Keyboard.write(0xD9); // send a 'Down-Arrow' to XCSoar
delay(200); // delay so there aren't a kajillion arrows's
}
if (digitalRead(9) == 0) // if the button goes low
{
Keyboard.write(0xD8); // send a 'Left-Arrow' to XCSoar
delay(200); // delay so there aren't a kajillion arrows's
}
if (digitalRead(10) == 0) // if the button goes low
{
Keyboard.write(0xD7); // send a 'Right-Arrow' to XCSoar
delay(200); // delay so there aren't a kajillion arrows's
}
}