Hi everyone I'm trying to use an arduino as a keyboard emulator to repeat a series of keyboard strokes. I found this playground example Arduino Playground - Ps2mouse but I cant seem to get the arduino to write to the computer, the example is to go from keyboard to arduino. Could someone help me get a simple sketch going that would just type "Hello world" using ascii codes? I read up a little on keyboard scancodes but I'm lost on how to actually implement them.
If you have an UNO or a new Mega2560 then you can reprogram the atmega8u2 on it to be a USB Keyboard HID device. This makes the Arduino appear to be a keyboard. I've put details, source, firmware hex files, and a demo "hello world" sketch here: http://hunt.net.nz/users/darran/
Note that you can't upload sketches while its running the keyboard firmware, you have to flash back the Arduino-usbserial.hex firmware whenever you want to change the sketch.
Hi Darran. I also implemented the LUFA keyboard HID on the Uno's 8U2. My problem is that LUFA occupies about 4K, and 4K is reserved for the bootloader, so I don't have room to add extra code. I thought that perhaps I could free up some space by using a smaller bootloader, see my post today on this forum entitled "LUFA fills ATmega8U2's 4K of flash" (http://arduino.cc/forum/index.php/topic,56287.0.html). Do you have any advice on how make space available on the 8U2 by using a smaller bootloader?
Thanks,
Henry
if you add the following LUFA_OPTS to your make file you can save 196 bytes:
-D NO_DEVICE_SELF_POWER -D NO_DEVICE_REMOTE_WAKEUP -D NO_INTERNAL_SERIAL
I did search through the LUFA source to see if there were any obvious ways to reduce the code size but I didn't have much luck. All of the unused code is automatically stripped out so what is left is just the essentials.