So I'm trying to multiply the keyboard.write command with a variable but I can't find a way to do it.
I've tried
Counter3*keyboard.write(232);
And
Digitalread(counter3)*keyboard.write(232);
And various other combos
Thanks for your help.
So I'm trying to multiply the keyboard.write command with a variable but I can't find a way to do it.
I've tried
Counter3*keyboard.write(232);
And
Digitalread(counter3)*keyboard.write(232);
And various other combos
Thanks for your help.
Post a complete program with Code Tags. Post a link to the library you're using. What type does the write() function return and why do you want to multiply it by something?
232 - 136 = 96 = "Keypad 8 and Up Arrow" key.
Did you want to press the up-arrow key multiple times, without releasing between?
The only library I'm using is
Keyboard.h
The output is currently just one keystroke of the correct number.
I need it to produce multiple keystrokes depending on the variable.
The variable works I can see it in the output.
but is it even possible to multiply the keyboard.write output
So I can't even get
6*keyboard.write(230);
To work just sends a single 6 character
But
Keyboard.write(230);
is fine outputs a single 6 character like it should.
Kind of hard to get at my code right now I'll try and strip it out abit
Yes I think you get the idea John so I'm trying to get it to output say keypad number 6 say 10x
Thanks
Consider a For Loop.
Cadvice:
Yes I think you get the idea John so I'm trying to get it to output say keypad number 6 say 10x
So use a loop:
for (int i=0; i < 10; i++)
{
keyboard.write(96+136); // 96 = "Keypad 8 and Up Arrow" key on US-EN keyboard
}
You could even define a function if you are going to be doing this kind of thing a lot.
void RepeatKey(int count, byte keycode)
{
for (int i=0; i < count; i++)
{
keyboard.write(keycode);
}
}
Then, to repeat the Up Arrow code 10 times:
RepeatKey(10, 96+136); // 96 = "Keypad 8 and Up Arrow" key on US-EN keyboard
Thank you both so much works like a charm.
Ian.