All Projects → pimoroni → keybow-python

pimoroni / keybow-python

Licence: MIT License
Python library for the Pimoroni Keybow 3 and 12 key mechanical keyboard add-ons for Raspberry Pi

Programming Languages

python
139335 projects - #7 most used programming language
Makefile
30231 projects
shell
77523 projects

Projects that are alternatives of or similar to keybow-python

pypi-command-line
A powerful, colorful, beautiful command-line-interface for pypi.org
Stars: ✭ 32 (+18.52%)
Mutual labels:  pypi-package
cp-tool
cp-tool is an auto generator for solved problems at different online judges.
Stars: ✭ 24 (-11.11%)
Mutual labels:  pypi-package
unicornhatmini-python
Python library for the Pimoroni Unicorn HAT Mini RGB LED Display
Stars: ✭ 32 (+18.52%)
Mutual labels:  pypi-package
dynamic-cli
A Modern, user-friendly command-line HTTP client for the API testing, and if you're stuck - Search and browse StackOverflow without leaving the CLI
Stars: ✭ 151 (+459.26%)
Mutual labels:  pypi-package
pycln
A formatter for finding and removing unused import statements.
Stars: ✭ 161 (+496.3%)
Mutual labels:  pypi-package
st7789-python
Python library to control an ST7789 240x240 1.3" TFT LCD display.
Stars: ✭ 120 (+344.44%)
Mutual labels:  pypi-package
ewtpy
Empirical wavelet transform (EWT) in Python
Stars: ✭ 52 (+92.59%)
Mutual labels:  pypi-package
sgp30-python
Python library for the SGP30 air quality sensor
Stars: ✭ 26 (-3.7%)
Mutual labels:  pypi-package
drum-hat
Python library for the Pimoroni Drum HAT Raspberry Pi Add-on board.
Stars: ✭ 26 (-3.7%)
Mutual labels:  pypi-package
rdkit-pypi
⚛️ RDKit Python Wheels on PyPi. 💻 pip install rdkit-pypi
Stars: ✭ 62 (+129.63%)
Mutual labels:  pypi-package
geneticalgorithm2
Supported highly optimized and flexible genetic algorithm package for python
Stars: ✭ 36 (+33.33%)
Mutual labels:  pypi-package
lightweight-push-pip
A lightweight way to push messages to Android devices (pip library package).
Stars: ✭ 14 (-48.15%)
Mutual labels:  pypi-package
ISS Info
Python wrapper for tracking information about International Space Station via http://open-notify.org
Stars: ✭ 12 (-55.56%)
Mutual labels:  pypi-package
st7735-python
Python library to control an ST7735 TFT LCD display. Allows simple drawing on the display without installing a kernel module.
Stars: ✭ 45 (+66.67%)
Mutual labels:  pypi-package
starcli
✨ Browse trending GitHub projects from your command line
Stars: ✭ 436 (+1514.81%)
Mutual labels:  pypi-package
neowise
Deep Learning library built from scratch with Python and NumPy
Stars: ✭ 16 (-40.74%)
Mutual labels:  pypi-package
PySDM
Pythonic particle-based (super-droplet) warm-rain/aqueous-chemistry cloud microphysics package with box, parcel & 1D/2D prescribed-flow examples in Python, Julia and Matlab
Stars: ✭ 26 (-3.7%)
Mutual labels:  pypi-package
github-flavored-markdown-to-html
Convert markdown to HTML using the GitHub API and some additional tweaks with Python. Comes with full formula support and image compression.
Stars: ✭ 44 (+62.96%)
Mutual labels:  pypi-package
fourletter-phat
Python library for the Pimoroni Four Letter pHAT
Stars: ✭ 28 (+3.7%)
Mutual labels:  pypi-package
chemlib
🧪 A comprehensive chemistry library for Python.
Stars: ✭ 26 (-3.7%)
Mutual labels:  pypi-package

Keybow

3 and 12 key, backlit mechanical keyboard add-ons for the Raspberry Pi

Build Status Coverage Status PyPi Package Python Versions

Installing

Stable library from PyPi

Enable SPI:

sudo raspi-config nonint do_spi 0

Install the library:

python3 -m pip install keybow

You may need to use sudo (or optionally python in lieu of python3)

Latest/development library from GitHub:

  • git clone https://github.com/pimoroni/keybow-python
  • cd keybow-python
  • sudo ./install.sh

API

@keybow.on() Detect Keypress

Decorator to attach a handler to a Keybow key. Your handler should accept an index and a state argument.

Handler callback params:

  • index: Integer - 0-based index of key to set the LED for, see #index
  • state: Boolean - True on key down, False on release
@keybow.on()
def handle_key(index, state):
    print("{}: Key {} has been {}".format(
        time.time(),
        index,
        'pressed' if state else 'released'))

keybow.set_all(r, g, b) Set all LEDs

Parameters:

  • r, g, b: Integer - amount of Red, Green and Blue (0-255)
keybow.set_all(0, 64, 128)
keybow.show()

NOTE: Use keybow.show() to update the LEDs actual state

keybow.set_led(index, r, g, b) Set a single led.

Parameters:

  • index: Integer - 0-based index of key to set the LED for, see #index
  • r, g, b: Integer - amount of Red, Green and Blue (0-255)
for x in range(4):
    keybow.set_led(x, 255, 0, 0)
for x in range(4):
    keybow.set_led(x + 4, 0, 255, 0)
for x in range(4):
    keybow.set_led(x + 8,  0, 0, 255)
keybow.show()

NOTE: Use keybow.show() to update the LEDs actual state

keybow.clear() Clear all LEDs

Turn off all LEDs

keybow.clear()
keybow.show()

NOTE: Use keybow.show() to update the LEDs actual state

keybow.show() Update LEDs

Whenever setting LEDs use this to update the LED values. This needs to be used whenever you set any LED values

Key index

With GPIO on the left, the index is mapped out as following:

9 10 11
6 7 8
3 4 5
0 1 2
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].