Pololu A-Star Keyboard Emulation

The Pololu A-Star can emulate a keyboard like an Arduino Leonardo, but I’m wondering if there is any chance the USB HID capabilities will be expanded. For instance, I use the Teensy a lot because of its abilities to emulate complex keyboard commands, as seen here: pjrc.com/teensy/td_keyboard.html

The Teensyduino library/add-on makes this stuff possible, so I’m wondering if the A-Star will see any advances beyond what the simple Arduino keyboard commands can do.

Hello.

You should be able to use the Teensyduino Keyboard libraries with the A* 32U4. We briefly played with it, and the examples seemed to work without any issues. However, we noticed with the A* connected, few of the settings were grayed out under the Tools menu (USB Type, CPU Speed, Keyboard Layout).

- Jeremy

I did try the Teensyduino libraries, but perhaps I’ll need to give it another shot. The Teensy expects a push of the reset button to upload the sketch, how is that done with the A-Star?

Ahh, found this: “To program the A-Star, you will need to get it into bootloader mode first. One way to do this is to reset the AVR twice within 750 ms. A pushbutton can be connected between the GND and RST pins to serve as a reset button, or you can use a wire.”

So would it be a matter of doing the reset when the Teensy software asks for it?

Hmmm, no dice. Tried with a lot of different settings. Any advice? How did you get it to work?

When we tried it, we had the A-Star 32U4 selected under Tools -> Board. You should still be able to use the Teensy libraries even without a Teensy board selected. You should not need to hit the reset button to program the A*; it should be automatically done by the Arduino IDE when you upload a program.

- Jeremy

I get errors when trying. It does not recognize the commands that the library contains. Is there some specific way the library needs to be included?

Sorry, it looks like we were wrong about the Teensy libraries working with the A* 32U4. I thought I had it working before because I was able to compile and run one of the Teensy keyboard examples on the A*, but it turns out that example only uses some basic functions that are also defined the stock Arduino keyboard library (which is what the example actually uses when it’s run on an A* or a regular Arduino).

Unfortunately, it doesn’t look like there’s an easy way to use the Teensy keyboard functions on a non-Teensy board, since they’re not actually part of a library; they’re part of a custom “core” that the Teensyduino add-on only makes available for Teensy boards. There’s no reason that functionality couldn’t be ported to the A* 32U4 and other boards like the Leonardo, since they use the same microcontroller as the Teensy 2.0 (ATmega32U4), but it might involve a lot of work and require familiarity with the ATmega32U4 and the way USB HID devices work.

What parts of the Teensy keyboard library do you want to use that aren’t available with the standard Arduino library? I’m guessing you want the set_modifier, set_key, and send_now functions to allow multiple keys to be pressed at once?

- Kevin

Kevin, thanks for the reply! I think I can do most of what I need to do with the standard Arduino keyboard libraries, I was mainly hoping to avoid two sets of code, but I’ll dig around a bit and if things work out, I’ll probably order more of the A-Star boards. :slight_smile: