This winter, I’m trying something new with my students. I am inviting them to use a keyboard emulator for my physical computing class. It should make it very easy for them to receive physical switch data within their authoring environment (Adobe Flash). And because I want them to focus on the interaction rather than the programming, I created Jmulator, an ActionScript 3 library to simplify even further the usage of keyboard emulators (also know as keyboard encoders) in Flash.
For those who don’t know, a keyboard emulator is a USB or PS2 device which, as its name implies, emulates a regular computer keyboard. The main difference from a real keyboard is that the emulator does not have any keys. Instead, it offers many inputs to which you can connect switches (any on/off switches). A press on the switch therefore sends a keydown/keyup event to the computer. This makes it very easy to use external, physical switches in all sorts of computing environments.
Here is an example board, the I-PAC VE (that’s the board I am currently using):
As I said above, in the spirit of trying to make it as simple as possible for my students, I wrote the Jmulator ActionScript library. Here is what version 1.0b offers :
- All keyboard codes dispatched by the board have already been researched for you. To use the library you simply create an Emulator object and listen for an event matching the label printed on the board itself.
- It allows you to easily enable or disable the OS typematic feature. Typematic mode is when the OS repeatedly sends key down events when a key is being held down.
- It allows you to easily listen to only on events, only off events or both on and off events.
So far, the library has only been tested with the I-PAC VE board from Ultimarc. However, I would like to add support for more devices in the future. Adding a new device is very easy. It simply means mapping the board labels to the actual keystrokes being sent to the computer.
By releasing the library publicly, I am hoping that people will help me troubleshoot any issues it might have and provide comments and suggestions for its improvement. The library is available right now for download on the Jmulator project page.