pi-keys-generator
БесплатноЗапускает вложенные скриптыНе проверенThis skill generates Python scripts and shell scripts to control RGB LEDs on the Raspberry Pi 500+ keyboard. Use this skill when the user asks to create…
Об этом скилле
Pi Keys Generator
Overview
This skill generates Python and shell scripts for controlling RGB LEDs on the Raspberry Pi 500+ keyboard using the RPiKeyboardConfig Python library and rpi-keyboard-config command-line tool.
When to Use This Skill
- Creating scripts to set specific keys to specific colors
- Building keyboard LED animations (rainbow, breathing, waves)
- Developing notification systems (flash keys for alerts)
- Making typing-reactive effects
- Setting up preset configurations
- Any task involving Pi 500+ keyboard LED control
Output Locations
Save generated files to these locations if the directories exist:
- Python scripts:
$MOVING_RAINBOW_HOME/src/pi-500-keyboard/examples/ - Shell scripts:
$MOVING_RAINBOW_HOME/src/pi-500-keyboard/scripts/
If the directories do not exist, save to the user's current working directory.
Script Generation Guidelines
Python Script Template
All Python scripts controlling the keyboard follow this structure:
#!/usr/bin/env python3
"""
Script description here.
"""
from RPiKeyboardConfig import RPiKeyboardConfig
import colorsys
import time
def rgb_to_hsv(r, g, b):
"""Convert RGB (0-255) to HSV (0-255 scale for all components)."""
h, s, v = colorsys.rgb_to_hsv(r / 255.0, g / 255.0, b / 255.0)
return (int(h * 255), int(s * 255), int(v * 255))
# Define colors in RGB format
RED = rgb_to_hsv(255, 0, 0)
GREEN = rgb_to_hsv(0, 255, 0)
BLUE = rgb_to_hsv(0, 0, 255)
OFF = (0, 0, 0)
def main():
keyboard = RPiKeyboardConfig()
try:
# Save current preset to restore later
current_preset = keyboard.get_current_preset_index()
# Enable direct LED control
keyboard.set_led_direct_effect()
# === Main logic here ===
except KeyboardInterrupt:
print("\nInterrupted by user")
finally:
# Cleanup: restore previous state
keyboard.rgb_clear()
keyboard.send_leds()
keyboard.set_current_preset_index(current_preset, save_index=False)
keyboard.close()
if __name__ == "__main__":
main()
Shell Script Template
Shell scripts use the rpi-keyboard-config command:
#!/bin/bash
# Script description here
# Set an effect
rpi-keyboard-config effect <effect_id> [--speed 255] [--hue 128] [--sat 255]
# Set a preset
rpi-keyboard-config preset index <0-6>
# Set all LEDs to a color (HSV format: "hue,sat,val")
rpi-keyboard-config leds set --colour "128,255,255"
# Set all LEDs to a color (RGB format)
rpi-keyboard-config leds set --colour "rgb(255,0,0)"
# Clear all LEDs
rpi-keyboard-config leds clear
# Set brightness (0-255)
rpi-keyboard-config brightness 255
Color Reference (HSV)
Colors use HSV format with values 0-255:
| Color | Hue Value |
|---|---|
| Red | 0 |
| Orange | 21 |
| Yellow | 43 |
| Green | 85 |
| Cyan | 128 |
| Blue | 170 |
| Purple | 213 |
Saturation: 255 = full color, 0 = white Value: 255 = full brightness, 0 = off
Using RGB Colors (Recommended)
While the RPiKeyboardConfig library requires HSV colors, you can define colors in the more familiar RGB format and convert them using Python's built-in colorsys module.
RGB to HSV Conversion Helper
Add this helper function to your scripts:
import colorsys
def rgb_to_hsv(r, g, b):
"""Convert RGB (0-255) to HSV (0-255 scale for all components)."""
h, s, v = colorsys.rgb_to_hsv(r / 255.0, g / 255.0, b / 255.0)
return (int(h * 255), int(s * 255), int(v * 255))
Defining Colors in RGB
# Define colors in familiar RGB format
RED = rgb_to_hsv(255, 0, 0)
GREEN = rgb_to_hsv(0, 255, 0)
BLUE = rgb_to_hsv(0, 0, 255)
YELLOW = rgb_to_hsv(255, 255, 0)
CYAN = rgb_to_hsv(0, 255, 255)
MAGENTA = rgb_to_hsv(255, 0, 255)
ORANGE = rgb_to_hsv(255, 165, 0)
WHITE = rgb_to_hsv(255, 255, 255)
OFF = (0, 0, 0)
# Use with the keyboard API
keyboard.set_led_by_matrix(matrix=[0, 1], colour=RED)
This approach is preferred because:
- RGB values are more intuitive and widely understood
- Easy to use web color pickers to find RGB values
- No need to memorize HSV hue values
Key Matrix Reference
Common key positions (row, column):
| Key | Matrix Position |
|---|---|
| ESC | [0, 0] |
| F1-F12 | [0, 1] through [0, 12] |
| W | [2, 2] |
| A | [3, 1] |
| S | [3, 2] |
| D | [3, 3] |
| Space | [5, 6] |
| Arrow Up | [4, 15] |
| Arrow Left | [5, 14] |
| Arrow Down | [5, 15] |
| Arrow Right | [5, 16] |
For the complete matrix layout, use: rpi-keyboard-config info --ascii
Common Patterns
Set Specific Keys to a Color
# Set function keys F1-F4 to blue (using RGB conversion)
BLUE = rgb_to_hsv(0, 0, 255)
f_keys = [[0, 1], [0, 2], [0, 3], [0, 4]]
for pos in f_keys:
keyboard.set_led_by_matrix(matrix=pos, colour=BLUE)
keyboard.send_leds()
Flash Effect for Notifications
def flash_keyboard(keyboard, color, times=3, delay=0.2):
"""Flash entire keyboard a color."""
f
Установить pi-keys-generator в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл pi-keys-generator?
This skill generates Python scripts and shell scripts to control RGB LEDs on the Raspberry Pi 500+ keyboard. Use this skill when the user asks to create keyboard lighting effects, animations, color patterns, notification systems, or any program that controls the Pi 500+ keyboard LEDs. This skill should be used for requests like "turn F1-F12 keys blue", "create a typing speed indicator", or "make an email notification effect".
Как установить скилл pi-keys-generator?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл pi-keys-generator запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
от Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
от Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
от Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
от Anthropic