This is an open source keyboard that runs Python internally and can be customized to your needs.

From now on, “poor players” can also play in MOBA games with one button, I wonder if this is hardware plugins?

A Chinese developer has opened source code on GitHub to manually “solder” Python keyboards with USB and Bluetooth.

The project uses a specific implementation of CircuitPython (derived from MicroPython) developed by the folks at AdaFruit, which can run on a virtual machine with 256K of code space and 16K of RAM.

This Python keyboard makes it easy to write control boards in Python.

Project address: github.com/makerdiary/…

Let’s take a look at the Python keyboard operation and implementation details.

steps

On GitHub, the author detailed the steps to make this Python keyboard, which includes:

1, manual “welding” keyboard

The drawings below show how the authors have modified the internal structure of these keyboards.

By removing the keypad cap, the author uses welding wire to connect the related keys to achieve the effect as shown below.

Finally, the authors attached an open source console capable of running Python to the keyboard. The final illustration is shown below.

2. Program Pitaya Go

The second step is to program the red device in the image above.

The author wrote a detailed guide on Github to program Pitaya Go and burn it to Flash CircuitPython firmware.

Download the CircuitPython library

Next, download the two CircuitPython libraries, Adafruit-ble and Adafruit-hid, and place them in a lib directory on a USB drive named CIRCUITPY, as shown below.

4. Copy code

The last step is to copy the Python code to code.py. After reloading code.py, we have a keyboard with USB and Bluetooth.

The full code author is also open-source to the Github project.

Productivity upgrade

60% of keyboards (61 keys) lack keys such as F1 to F12, arrow keys, PgUp, and PgDn.

This project adds the key mapping function of TMK_Keyboard project, and also refers to the optimization concept of key setting of Toward a More Useful keyboard project, making the keypad more productive. “It’s fun to play around, but don’t buy a full keyboard”!

Tmk_keyboard Project Address: github.com/tmk/tmk_key…

Project address: github.com/jasonrudolp…

Thanks to the keymapping written in Python, we can easily personalize the keys. “Who needs a macro keyboard? Fog.” The project comes with tap-key, which activates alternative function modes by holding down a key, expanding more keys on 60% of the keyboard. Py and keycodes.py are copied to CIRCUITPY, and then we modify code.py to import the new keyboard to use D as navigation.

When you only want to output D, you can quickly tap, while holding DOWN D activates the navigation function, and the changed key is shown in the figure below.

At this time, H, J, K, and L keys are mapped as up, down, left, and right direction keys respectively, while U and N are mapped as PgUp and PgDn.

There is also support for holding down two keys at the same time (less than 25 milliseconds apart) to activate alternative function modes, and holding down the “; “button. Key as Ctrl.

Why write in Python?

The project has attracted a lot of attention on HackerNews and Twitter. Most people thought it was a very creative idea and hadn’t seen anything like it before.

But given that the author is working in Python, there are concerns about speed. To this, the authors reply, “It is a bit slow, it currently takes 4 ms to scan a matrix, but the speed will be improved after optimization.”

Since Python is slow, why not write in C? It’s not that complicated.

“The hardware in the project includes a QSPI flash memory, which is a USB storage for Python source code that you can change directly,” the authors say. “Furthermore, using Python provides a new way to quickly validate ideas for hardware products.”

In addition, some people have supplemented the benefits of using Python for the author.

Ta points out that the CircuitPython implementation used for this project runs on a very different VM and, while not expected to come close to C performance, is much lighter than Cpython. The whole development process will also be much simpler.

Wenyuan network, for learning purposes only, delete.

You will definitely encounter difficulties in learning Python. Don’t panic, I have a set of learning materials, including 40+ e-books, 800+ teaching videos, covering Python basics, crawlers, frameworks, data analysis, machine learning, etc. Shimo. Im/docs/JWCghr… Python Learning Materials

Follow the Python circle and get good articles delivered daily.