Hi Community,
I’m developing some sort of hybrid keyboard with a Teensy++ 2.0, I really like PlatformIO because it gives me a lot of possibilities but I’m still a noob with it.
I’ve just created a keyboard volume knob with a rotary encoder, basically the code below is perfectly valid:
#include <usb_private.h>
#include <Arduino.h>
...
switch (Action) {
case GAUGE_UP:
Keyboard.press(KEY_MEDIA_VOLUME_DEC);
delay(100);
Keyboard.release(KEY_MEDIA_VOLUME_DEC);
break;
case GAUGE_DOWN:
Keyboard.press(KEY_MEDIA_VOLUME_INC);
delay(100);
Keyboard.release(KEY_MEDIA_VOLUME_INC);
break;
}
I can compile it and runs fine with this platformio.ini
file:
[env:teensy2pp]
platform = teensy
board = teensy2pp
framework = arduino
build_flags = -D USB_HID
extra_scripts = buildHooks.py
But in my case I also need to use a Serial Port so I switched it to:
[env:teensy2pp]
platform = teensy
board = teensy2pp
framework = arduino
build_flags = -D USB_SERIAL_HID
extra_scripts = buildHooks.py
It’s slightly different, I can still compile the whole project without troubles but it doesn’t work.
With the latest config (-D USB_SERIAL_HID
) the code above doesn’t send Vol Up/Down anymore. If I use a different key (for example: KEY_A) I can see it working, but in my case I really need to use Multimedia Volume Keys (like logitech or other manufacturers do).
Do you have any hints on it ? I need a Mouse, a Keyboard and a Serial port so using USB_SERIAL_HID seems to be the right one.
Thank you in advance for your reply
Regards
Ben