Complete noob here =) sending key combinations?

hi, i'm brand new to the world of hardware, and i'm loving it! My current project is to automatically log me off of my workstation when I press a button. Once I figure that out I can play with this RFID reader =D

My problem is, I cannot find a specific program or method to send the combination of keys to log off of a windows workstation (winkey + L). SerialKeys, asciikey, and the other methods that i've seen that use the serial.write method type out letters one by one, or don't have winkey support. GoBetwino reqires a process ID to send to but since it's a generic logoff there IS no pid to send to...

any solutions? I'm debating getting a cheapo USB keyboard, hacking it up, and using the arduino to trigger keypresses and send it that way as a last ditch effort!

Thanks in advance!

Also, being brand new to the physical computing world, any recommendations on what components every newbie needs? I have motors, breadboard, piezo, leds, buttons, and intend to get a stepper, but is there any "should be in every toolbox" toys i'm missing?

You're probably best off having a program running on your host that listens to the serial port.

In C++ the simple line:

system("logout");

should log you off.

You could also invoke a visual basic script to execute some keystrokes.

windows xp pro and I assume other pro versions of windows has a shutdown command that you can use from the command line, maybe that is an option?

This would work to log off, but the problem i saw that i neglected to mention is logging in. I'm scatter brained ATM, my brain is all over the place haha. On system boot there's no way to have my software running to listen/relay keystrokes....I think the only way to accomplish what i'm planning is to emulate a keyboard. I saw the ps/2 library, and though my workstation lacks a ps/2 port i'm hoping a ps/2 to USB will work for my needs here.

Off to scour for sample sketches of ps/2 library projects =)

My recommendation to look for missing stuff?

Adafruit hs some starter kits.

Great fun is an Ethernet shield, also maybe one of the LCD/buttons or LCD/joystick boards. The chip in one of the more popular shields can even use DSL - imagine switching off your PC from work :slight_smile:

If you can build the associated shield then the combination of Arduino + V-USB should enable you to send the keystroke+modifier you require.

--Philip;

Hi,

If you just want to be able to log off or shut down the computer by pressing a button on the keyboard then I believe you might be able to (although I've never tried) do this with an extremely simple coding language called autohotkey which enables you to remap your keyboard or make a button on the keyboard do something else, in your case logging off. I know this is not arduino related but if you are interested anyway here is the link - http://www.autohotkey.com/. Just search "shutdown" in the search box and you might get something.

Thanks.

Maybe you can use Teensyduino for what you want? Teensyduino - Add-on for Arduino IDE to use Teensy USB development board

Update: Keyboard & Mouse type are now available in Teensyduino 0.6. Select it from the Tools->Boards menu, and your sketch can type with Keyboard.print("whatever") and use the mouse with Mouse.move(x,y) and Mouse.click().