benownzu93 Posted May 5, 2010 Share Posted May 5, 2010 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? Quote Link to comment Share on other sites More sharing options...
Mr-Protocol Posted May 5, 2010 Share Posted May 5, 2010 (edited) 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 May 5, 2010 by Mr-Protocol Quote Link to comment Share on other sites More sharing options...
benownzu93 Posted May 5, 2010 Author Share Posted May 5, 2010 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.