Photon not working as HID keyboard

I’ve been trying to get a photon to work as a keyboard to automatically type in some lines in a terminal program, and haven’t been able to get it to work. I’ve tried copying @ScruffR code exactly from the post below, only removing SYSTEM_MODE(SEMI_AUTOMATIC) because I don’t need it. So far I haven’t gotten it to type out anything on pressing the setup button, and in device manager it never seems to show up as an HID. I’m running firrmware 1.4.0 if thats relevant.

I’ve tried different cables with no change, I am able to see the device in the com port and flash over dfu, so thats not an issue.

Continuing the discussion from Why does Keyboard HID only work when system mode is automatic?:

What is your host OS.
I have troubles with USB HID on Solaris and some Linux distros but Windows usually works.

I’m using Windows 10 home edition. I don’t suppose I need to include a library? Looking through the docs and other posts, it seems the photon should be able to handle this natively, but I thought I would check just in case.

I pulled a brand new photon out of the box, updated it to 1.5.0, and flashed this code:


void setup() {

void loop() {
  if (!digitalRead(BTN)) {
    Keyboard.printlnf("Test %lu", millis());

and still no results.

I’ll have to try this with 1.5.0

1 Like

I’m not suggesting 1.5.0 has a problem, since the first one was on 1.4.0.

I have just tested this on a Photon with 1.5.0 and it works as expected


void setup() {
  Particle.function("type", sendKbd);

int sendKbd(const char* cmd) {
  return strlen(cmd);

You can use this to test this on the same machine you have the Photon connected to

particle call <yourDeviceName> type "Some text to type"

or can use console to “type” something on a remote machine

If this doesn’t work you may have some issues with drivers on your Win10 machine.
Try some other computer.

1 Like

I’ll try it out today. I did have some issues with the CLI, had to completely uninstall it and start fresh. I’ll check it out and report back.

I tested on another computer (Windows 7) and it works fine, so I tried updating the drivers for the photon following the steps provided here: Photon Installation - Windows 10 Driver - Other Driver Category Not Shown to update manually and I’m told the latest drivers are already installed.

It’s not the Particle drivers you need to worry about.
Some other driver seems to be grabbing the Photon before Windows’ own USB HID drivers can get hold of the device.

1 Like

I think it may have been something in the particle drivers.
To fix the issue, I had to go to:
Device manager >
Ports (com and lpt)>
Right click-> properties >
Driver >
Uninstall device

Then plug the unit back in and let windows find it and reinstall it. After that it came up and worked perfectly.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.