3
\$\begingroup\$

I have an Arduino Uno and a light sensor. I would like the light sensor to activate the [H] button on my keyboard. If the light sensor is in the dark (1024 I can see in the monitor) it should have the same effect as holding the [H] button until there is light again. How do I go about this?

At this moment The arduino en sensor works, I think I should be able to read out the serialport en then, when the output is near 1024, trigger an event like holding the [H] key. I only have no idea where to look on the web, what words to look for or if this is so basic that there is a piece of coding out there.

working on an art-installation, help is very welcome :)

\$\endgroup\$
2
  • \$\begingroup\$ What does the H key do? You can instead maybe send PS/2 commands directly to your PC like pressing 'H' . But how exactly is all this configured. I can try and help but I need some details :) Website.. plans..etc :D \$\endgroup\$
    – Piotr Kula
    Jun 9, 2011 at 11:02
  • \$\begingroup\$ Thank you all for your so much valuable info! Very much appreciated. \$\endgroup\$
    – user4620
    Jun 11, 2011 at 6:45

4 Answers 4

1
\$\begingroup\$

You need to write an Arduino sketch trigger on your sensor and send a message over the serial port to your PC. Then, you need some PC side software to interpret this message and fake a keyboard event.

Here's an example: http://www.arkadian.eu/pages/375/arduino-based-keyboard-for-windows

The other method is to reprogram the atmega-u8 coprocessor on your UNO to emulate a USB keyboard directly. This is more complex and may require an AVR ISP programmer.

http://hunt.net.nz/users/darran/weblog/faf5e/Arduino_UNO_Keyboard_HID_part_2.html

\$\endgroup\$
1
\$\begingroup\$

The easiest way

You send serial messages and using AAC that reads serial responses it will emulate keypresses or even mouse movements.

http://www.aacinstitute.org/Resources/ProductsandServices/AACKeys/AACKeys.html

The not so easy way

http://www.computer-engineering.org/ps2protocol/

Very good resources

The most difficult way

The usb way that Joby mentioned

\$\endgroup\$
0
\$\begingroup\$

The easiest way is to buy a cheapo USB keyboard, break it apart and follow the leads to the H key. Then make a couple wires come out of there and hook your arduino with light sensor up to a reed relay (they have them at RadioShack). Two wires from the relay go to your arduino, and two wires from the relay connect the two wires to the H key.

\$\endgroup\$
0
\$\begingroup\$

Assuming you have an Arduino UNO or Mega2560, the USB Keyboard HID approach is actually really easy. You don't need an programmer, you can just use DFU mode to load the HID Keyboard firmware onto the UNO's atmega8u2 using either the dfu-programmer application (Linux, OS X), or flip (windows).

Take a look at my blog for details: Arduino Hacking

Cheers, Darran.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.