I've built a silly program in Action Script (Flash) where I launch 4 different actions by striking 1,2,3 or 4 keys on my keyboard...
I would like to map this commands off my Arduino and breadboard buttons
I'm a weak electrician and I have no idea how to wire this up nor how to start a good sketch for my Arduino...but I'm improving... and working hard!
I went through a few posts encouraging me to use PS/2 adapter, but in fact I would like my buttons to be recognized as buttons...just as if it was a little keyboard with 4 keys only. But the talk wasn't really in my level of expertise
I guess I need a library to import into my sketch and ideally the very same USB cable I use to send serial data my Mac I would make it behave as if I was striking the numbers..the Action script will do the rest.
I wonder if the lack of response means that others are as confused as I am by your question?
Are you saying that you have something that runs in your Mac WITHOUT an Arduino, and when you press 1, 2, 3 or 4 on the Mac's keyboard, then something happens in the Mac because of it?
And that you want to change things so that four buttons connected to an Arduino cause the Ardy to send a message to the Mac to make it do what it already does when you press 1, 2, 3, or 4 on the Mac's keyboard?
If so, I'd suggest you change the thread topic to "How can I trigger action in Mac from Arduino?"
Canned Forum Reply
[ ] Please rephrase your question into a real question.
[ ] Your question is an obvious homework problem.
[ ] Your question contains no question.
[ ] No paragraphs make my eyes bleed.
[x] Your question is readily answered using Google and these keywords
arduino hid usb
sigh. if the OP has a atmega328 or a Teensy device, he can use code to make the device be a HID usb device. Each has an example of emulating a keyboard or mouse.
he can use code to make the device be a HID usb device
Note that in order to do this, you need a custom USB shield (from what I have seen, they aren't that difficult to solder up) - someone by now probably manufactures one...
The scenario is this... I have this silly Flash running in my Mac. When I press 1 something happens in the Flash animation, and so it does when i press 2,3 and 4... for different animations comes alive.
I want to build nice buttons so I got a Arduino 168 to manage this. I have he art o the buttons finished, it's not a regular keyboard, it is a special keyboard based on Arduino.
So, my question regards to get me an idea of a sketch that will put my 4 buttons on the breadboard to work just as if they were number 1,2,3 and 4 on a regular keyboard, thru the very same USB A-B connection I use to power up my Ardy board!
If you want to make the arduino work like a USB keyboard recognised by the PC as a USB keyboard device without any extra software on the PC side then the answer is you can't do that.
This is because this requires the PC to see a USB HID device. The arduino looks to the PC like a serial port not a keyboard. Therefore you need some software on the PC side that looks at the serial port taking data from the arduino and some how squirts this information into the PCs input stream.
An alternative is to take the controller from a cheap USB-keyboard and connect the buttons to the controller's matrix. That would probably be the easiest solution.
I dont know why you would buy an arduino for this, why not buy a cheap keyboard, take it apart, and solder your buttons the the keys you want to use?????
I dont know why you would buy an arduino for this, why not buy a cheap keyboard, take it apart, and solder your buttons the the keys you want to use?????
Have you ever taken apart a cheap keyboard? Most of the time nowadays (but even when I was a kid you saw this too - check out an old Big Trak keypad, for instance) the matrix is a couple of sheets of plastic with another sheet in between, and all the traces are screen printed to the plastic (probably some kind of polyester). If you are lucky, you might be able to solder to the interface PCB if the traces are wide and thick enough to cut-n-scrape to copper.
I do agree, though, that it would likely be much easier (and more successful) than attempting to implement your own HID code...
Of course you can make the arduino do this... (see rancid bacon page) but by the time you are done... you have done the equivalent of putting a V8 engine on a bicycle... little room for much else if you get it working.
If you don't mind going outside the Arduino world, there are some devices mentioned at....
... which may be useful to your project. Extracts...
... the PIC 18F4550. (Microcontroller with USB built in) The Sparkfun experimenter's board looks like a fine solution to the hardware issues. ($38 at 2/10)
If you are into making your own electronic devices, you might be interested in the USB modules from www.ftdichip.com's products page.
I wrote the following a while ago... and now (3/10) am not sure what device it describes! I think it is the FT2232H from FTDI, but I'm not sure, and after 15 minutes of struggling around their site, I've given up trying to find what I saw previously, somewhere. If it sounds good to you, do go to FTDI's site.... I think you will be rewarded!
For about $20, you can buy a little unit that plugs into a Win98 or higher machine via USB. On the "outside world" side, it has 8 bi-directional digital input/ outputs, and a few handshake lines. The programming isn't trivial, but there is great material about accessing the device. Illustrations in Delphi are provided. You either install a TComPort component (a freeware one, with Delphi source code is available from Dejan Crnila and then access the 8 bits as if (to Win98) they were on a COM port, OR you use a DLL (supplied royalty free from FTDI). It is not exactly a parallel port via USB, but that's roughly the idea.