Hi.
I still have not figured out what is going on.
Once I add counter to the code it will start to send random keys to the PC:
If I use one button to send one Symbol it works.
Is there another way to send numbers from 0 to 9 (or some other keys) without using Counter?
I have tried that random key press works fine.
Anyideas how to use it?
/* Arduino USB HID Keyboard Demo
* Random Key/Random Delay
*/
uint8_t buf[8] = {
0 }; /* Keyboard report buffer */
void setup()
{
Serial.begin(9600);
randomSeed(analogRead(0));
delay(200);
}
void loop()
{
int randomChar = random(4, 130);
long randomDelay = random(1000, 10000);
delay(randomDelay);
buf[2] = randomChar; // Random character
Serial.write(buf, 8); // Send keypress
releaseKey();
}
void releaseKey()
{
buf[0] = 0;
buf[2] = 0;
Serial.write(buf, 8); // Release key
}