Jump to content

[Version 1] Little Help


Recommended Posts

this is some of my code

void setup(){
  delay(3000);
  ctrlcombo("KEY_A");
}

void ctrlcombo(char* ctrlkey){
  Keyboard.set_modifier(MODIFIERKEY_CTRL);
  Keyboard.set_key1(ctrlkey);
  Keyboard.send_now();
  Keyboard.set_modifier(0);
  Keyboard.set_key1(0);
  Keyboard.send_now();
}

I get this error "invalid conversion from 'char*' to 'uint8_t'" can any one help me?

Link to comment
Share on other sites

Keyboard.set_key1(ctrlkey);

It doesn't like that line i'm assuming. You are sending it a char value when it wants one of it's defined key codes KEY_A not "KEY_A"

KEY_A is like a defined constant. So it doesn't need quotes. you may have to change the input type of your function as well so it's not expecting a CHAR array and you giving it something different.

Try:

void setup(){
delay(3000);
ctrlcombo(KEY_A);
}

void ctrlcombo(uint8_t ctrlkey){
Keyboard.set_modifier(MODIFIERKEY_CTRL);
Keyboard.set_key1(ctrlkey);
Keyboard.send_now();
Keyboard.set_modifier(0);
Keyboard.set_key1(0);
Keyboard.send_now();
}

Or read up a lil at http://www.pjrc.com/teensy/td_keyboard.html

I can't test because I'm at work. Speaking of which I got a meeting in 5 min.

Edited by Mr-Protocol
Link to comment
Share on other sites

Yeah I needed to remove the quotes. It would not recognize uint8_t. But it works with char not char* so this works now.

void setup(){
delay(3000);
ctrlcombo(KEY_A);
}

void ctrlcombo(char ctrlkey){
Keyboard.set_modifier(MODIFIERKEY_CTRL);
Keyboard.set_key1(ctrlkey);
Keyboard.send_now();
Keyboard.set_modifier(0);
Keyboard.set_key1(0);
Keyboard.send_now();
}

I can't test because I'm at work. Speaking of which I got a meeting in 5 min.

haha, I was at school when I posted this topic, exams mean that teacher is a bit to busy to help me with this at the moment.

Thanks for your help.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...