avrdude -p m328p -F -P usb -c USBasp -U flash:w:Arduino-keyboard-0.3.hex
The upload appears to complete successfully.
I then upload a test sketch via the ICSP Programmer, to send a random character to the attached Macbook Pro.
Code: Select all
/* 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));
pinMode(13, OUTPUT);
delay(2000);
}
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
}
http://mitchtech.net/arduino-usb-hid-keyboard/
The random characters do not appear in a running text editor application, however they do appear in the Serial Monitor of the Arduino IDE, which seems to point to the USB HID firmware as not functioning as expected.
Is anyone able to assist me in pointing out where I may be going wrong?
Many thanks, in advance.
Jez