Go Down

Topic: USB keyboard, difficulty passing decimal key arguments to a function (Read 865 times) previous topic - next topic

Paul Beaudet

Quote
I got lost here. What do you mean by "and press takes decimals"? decimals is not a type. Or a meaningful description of a numeric value, either.

basically unsigned byte 1100001 goes through but unsigned byte 10000010 gets ignored and I am not really sure why because if the latter value didn't get ignored my program would work the way I expect it to.

PaulS

Quote
basically unsigned byte 1100001 goes through but unsigned byte 10000010 gets ignored and I am not really sure why because if the latter value didn't get ignored my program would work the way I expect it to.

Goes through what? How do you know that it goes through whatever?

Paul Beaudet

solution... embarrassingly enough the answer was pulled from my first sketch from a couple of weeks ago... real simple, assign the key definitions to chars. Why this works or why I did this to begin with and forgot, I couldn't tell you.
Code: [Select]

char super= KEY_LEFT_GUI;
char ctrl= KEY_LEFT_CTRL;
char alt= KEY_LEFT_ALT;
char f4= KEY_F4;
char f2= KEY_F2;
char tab= KEY_TAB;

void setup()
{
  Keyboard.begin();
  delay(500);
  combo(alt, f2);
  delay(200);
  Keyboard.println("mate-terminal");
  delay(200);
}

void loop()
{
}

void combo(char key1, char key2)
{
  Keyboard.press(key1);
  Keyboard.press(key2);
  delay(100);
  Keyboard.releaseAll();
}

passing char shift=129 must be blocked by magic smoke, because this is the only thing that I could get to work.

PaulS

Quote
passing char shift=129 must be blocked by magic smoke, because this is the only thing that I could get to work.

Possibly because char is a signed type, with a valid range of values from -128 to 127.

Paul Beaudet

Quote
Possibly because char is a signed type, with a valid range of values from -128 to 127.

good point, i'm kinda all over all over the place in how I misuse and understand terminology. However tested with the byte data type the same results occur   

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy