HID Keyboard functionality?

The official pyboard running MicroPython.
This is the reference design and main target board for MicroPython.
You can buy one at the store.
Target audience: Users with a pyboard.
Posts: 3
Joined: Wed Jan 01, 2014 11:10 am

Re: HID Keyboard functionality?

Post by zelib0ba » Wed May 06, 2015 6:19 am

pyb.usb_mode('CDC+HID', pyb.hid_keyboard) in boot.py
TypeError: extra positional arguments given

ver of firmware:
Micro Python v1.4.2-25-g9472907 on 2015-04-28; PYBv1.0 with STM32F405RG

User avatar
Posts: 3457
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada

Re: HID Keyboard functionality?

Post by dhylands » Wed May 06, 2015 4:16 pm

I think you need to use:

Code: Select all

pyb.usb_mode('CDC+HID', hid=pyb.hid_keyboard)
(i.e. add the hid=)

Posts: 7
Joined: Sun Dec 29, 2013 3:34 pm

Re: HID Keyboard functionality?

Post by plakkies » Thu Jun 18, 2015 2:18 pm

This works awesome. However, I cant work out how to do a capital letter. This is what I tried.

Code: Select all

    buf = bytearray(8) # report is 8 bytes long
    buf[2] = 0xE1
    hid.send(buf) # key pressed

    buf[2] = 0x04
    hid.send(buf) # key pressed
    pyb.delay(10) # wait until report sent; can also use: select.select([], [hid], [])
    buf[2] = 0
    hid.send(buf) # key released
id think this would give me a "A" but it gives an "a"

Posts: 1
Joined: Thu Nov 26, 2015 12:33 am

Re: HID Keyboard functionality?

Post by Ashmon » Thu Nov 26, 2015 3:58 am

My apologies in advance for resurrecting an older thread.

Is it possible to bind the micropython board as an HID which is both a keyboard and a mouse at the same time?

Rather than
pyb.usb_mode('CDC+HID', hid=pyb.hid_keyboard)
something like
pyb.usb_mode('CDC+HID', hid=pyb.hid_keyboard_mouse)

Posts: 64
Joined: Wed Jul 20, 2016 12:08 pm

Re: HID Keyboard functionality?

Post by fpp » Sat Oct 08, 2016 1:14 pm

Post Reply