一键导入
moving-rainbow
Generate MicroPython programs for the Moving Rainbow LED strip educational project using Raspberry Pi Pico with NeoPixel strips and button controls.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Generate MicroPython programs for the Moving Rainbow LED strip educational project using Raspberry Pi Pico with NeoPixel strips and button controls.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Load for ANY bug-fix task — code, UI/UX, content, docs, accessibility, or workflow. Reproduce → isolate → fix → prevent cycle with real-session patterns. GEPA-evolved from 353 real Claude Code session bugfixes (+31pp holdout).
Generate Canvas-ready HTML pages and assignments for BADM 350 Technology & AI Strategy course. Use when building weekly module content from markdown lesson plans, creating "Start Here" pages with Tuesday/Thursday session structure, or generating assignment HTML with rubrics. Triggers on requests to "build Canvas content", "create week X page", or "generate assignment for BADM 350".
This skill generates a structured chapter outline for intelligent textbooks by analyzing course descriptions, learning graphs, and concept dependencies. Use this skill after the learning graph has been created and before generating chapter content, to design an optimal chapter structure that respects concept dependencies and distributes content evenly across 6-20 chapters.
This skill generates comprehensive metrics reports for intelligent textbooks built with MkDocs Material, analyzing chapters, concepts, glossary terms, FAQs, quiz questions, diagrams, equations, MicroSims, word counts, and links. Use this skill when working with an intelligent textbook project that needs quantitative analysis of its content, typically after significant content development or for project status reporting. The skill creates two markdown files - book-metrics.md with overall statistics and chapter-metrics.md with per-chapter breakdowns - in the docs/learning-graph/ directory.
This skill generates interactive Chart.js bubble chart visualizations for priority matrices and multi-dimensional data analysis. Use this skill when users need to create scatter plots with variable bubble sizes, particularly for 2x2 priority matrices (Impact vs Effort, Risk vs Value, etc.), portfolio analysis, or any visualization comparing items across two dimensions with a third dimension represented by size. The skill creates a complete MicroSim package with HTML, CSS, and documentation.
This skill generates comprehensive chapter content for intelligent textbooks after the book-chapter-generator skill has created the chapter structure. Use this skill when a chapter index.md file exists with title, summary, and concept list, and detailed educational content needs to be generated at the appropriate reading level with rich non-text elements including diagrams, infographics, and MicroSims. (project, gitignored)
| name | moving-rainbow |
| description | Generate MicroPython programs for the Moving Rainbow LED strip educational project using Raspberry Pi Pico with NeoPixel strips and button controls. |
This skill helps create MicroPython programs for the Moving Rainbow educational project. Use this skill when the user asks to create LED animations, NeoPixel programs, or Moving Rainbow examples for Raspberry Pi Pico.
The default hardware setup consists of:
Configuration values are stored in a config.py file that should be imported by programs. See the references/config.py file for the standard configuration template.
All programs should follow this structure:
from machine import Pin
from neopixel import NeoPixel
from utime import sleep
import config
# Initialize the LED strip
strip = NeoPixel(Pin(config.NEOPIXEL_PIN), config.NUMBER_PIXELS)
# Your code here
while True:
# Animation loop
pass
machine, neopixel, utime, and the config modulewhile True: loop for continuous animations(red, green, blue) with values 0-255For smooth rainbow transitions, use the standard color wheel function:
def wheel(pos):
# Input a value 0 to 255 to get a color value.
# The colors are a transition r - g - b - back to r.
if pos < 0 or pos > 255:
return (0, 0, 0)
if pos < 85:
return (255 - pos * 3, pos * 3, 0)
if pos < 170:
pos -= 85
return (0, 255 - pos * 3, pos * 3)
pos -= 170
return (pos * 3, 0, 255 - pos * 3)
Setting pixels:
strip[index] = (red_value, green_value, blue_value)
strip.write() # Always call write() to display changes
Erasing the strip:
def erase():
for i in range(0, config.NUMBER_PIXELS):
strip[i] = (0, 0, 0)
strip.write()
Using a counter with modulo for wrapping:
counter = 0
while True:
# Use counter for position
strip[counter] = color
strip.write()
sleep(delay)
counter += 1
counter = counter % config.NUMBER_PIXELS # Wrap around
For interactive programs with button controls:
from machine import Pin
from utime import ticks_ms
import config
BUTTON_PIN_1 = config.BUTTON_PIN_1
BUTTON_PIN_2 = config.BUTTON_PIN_2
button1 = Pin(BUTTON_PIN_1, Pin.IN, Pin.PULL_DOWN)
button2 = Pin(BUTTON_PIN_2, Pin.IN, Pin.PULL_DOWN)
last_time = 0
def button_pressed_handler(pin):
global mode, last_time
new_time = ticks_ms()
# Debounce: require 200ms between button presses
if (new_time - last_time) > 200:
pin_num = int(str(pin)[4:6])
if pin_num == BUTTON_PIN_1:
# Button 1 action (e.g., increment mode)
mode += 1
else:
# Button 2 action (e.g., decrement mode)
mode -= 1
last_time = new_time
# Register interrupt handlers
button1.irq(trigger=Pin.IRQ_FALLING, handler=button_pressed_handler)
button2.irq(trigger=Pin.IRQ_FALLING, handler=button_pressed_handler)
def move_dot(counter, color, delay):
strip[counter] = color
strip.write()
sleep(delay)
strip[counter] = (0, 0, 0)
def color_wipe(color, delay):
for i in range(config.NUMBER_PIXELS):
strip[i] = color
strip.write()
sleep(delay)
def rainbow_cycle(counter, delay):
percent_color_wheel = round(255 / config.NUMBER_PIXELS)
for i in range(0, config.NUMBER_PIXELS):
color_index = round(i * percent_color_wheel)
color = wheel(color_index)
strip[(i + counter) % config.NUMBER_PIXELS] = color
strip.write()
sleep(delay)
def comet_tail(counter, color, tail_length, delay):
levels = [255, 128, 64, 32, 16, 8, 4, 2, 1]
for i in range(0, tail_length):
target = (counter - i) % config.NUMBER_PIXELS
scale = levels[i] / 255
strip[target] = (int(color[0]*scale), int(color[1]*scale), int(color[2]*scale))
strip.write()
sleep(delay)
from urandom import randint
def random_color(delay):
random_offset = randint(0, config.NUMBER_PIXELS - 1)
random_color_value = randint(0, 255)
strip[random_offset] = wheel(random_color_value)
strip.write()
sleep(delay)
For programs with multiple animation modes that can be switched with buttons:
mode_list = ['moving rainbow', 'red dot', 'blue dot', 'candle flicker', 'random']
mode_count = len(mode_list)
mode = 0
last_mode = -1
while True:
# Print mode changes
if mode != last_mode:
print('mode=', mode, 'running', mode_list[mode])
last_mode = mode
# Execute the current mode
if mode == 0:
moving_rainbow(counter, 0.05)
elif mode == 1:
move_dot(counter, red, 0.05)
# ... more modes
counter += 1
counter = counter % config.NUMBER_PIXELS
Use these common color constants:
red = (255, 0, 0)
orange = (255, 60, 0)
yellow = (255, 150, 0)
green = (0, 255, 0)
blue = (0, 0, 255)
cyan = (0, 255, 255)
indigo = (75, 0, 130)
violet = (138, 43, 226)
white = (128, 128, 128)
off = (0, 0, 0)
When generating programs, follow these educational guidelines:
counter, delay, color)strip.write() after modifying pixels to display changescounter % config.NUMBER_PIXELS to loop animationsimport config and reference config.NEOPIXEL_PIN, etc.sleep() calls to control animation speedUse this skill when:
Generated programs should: