wedsamuel1230/embedded-engineering-skills

arduino-code-generator

Generate Arduino and embedded C++ snippets for sensors, actuators, buses, state machines, timing, data logging, and hardware abstraction.

查看源码

使用方法

  1. 复制安装命令,在自己的智能体环境安装前先检查源码包。
  2. 从原始文档核对所需工具、凭据和支持的宿主。
  3. 说明输入材料与期望交付物,并对照来源检查输出。
npx skills add https://github.com/wedsamuel1230/embedded-engineering-skills --skill arduino-code-generator

开始前需了解

  • 安装不包含模型订阅、API 额度或访问文件的权限。
  • 仓库星数和安装量反映活跃情况,不等于独立质量或安全测试。
仓库原始内容

按源仓库内容呈现,保留标题、案例、代码、表格、链接以及原文引用的演示图片。

Arduino Code Generator

Generate production-quality Arduino code snippets for sensors, actuators, communication, and embedded patterns.

Quick Start

Browse example sketches:

bash
# See 9 production-ready examples in examples/ folder
ls examples/
# config-example.ino, filtering-example.ino, buttons-example.ino,
# i2c-example.ino, csv-example.ino, scheduler-example.ino,
# state-machine-example.ino, hardware-detection-example.ino,
# data-logging-example.ino

List available patterns:

bash
uv run --no-project scripts/generate_snippet.py --list

Generate code for specific pattern and board:

bash
uv run --no-project scripts/generate_snippet.py --pattern i2c --board esp32
uv run --no-project scripts/generate_snippet.py --pattern buttons --board uno --output button.ino

Interactive mode:

bash
uv run --no-project scripts/generate_snippet.py --interactive

Target Gate

Read the shared contract and the board profile before selecting pins, APIs, or libraries. Keep board-specific branches isolated, check memory and peripheral constraints, and state whether the result has build proof only or also has upload, hardware, and system proof. The generator's board flag is a template selector, not evidence that the generated code works on a similar-looking board.

Resources

  • examples/ - 9 production-ready example sketches (one per pattern category)
  • examples/README.md - Detailed documentation for each example with wiring diagrams
  • scripts/generate_snippet.py - CLI tool for code generation with 9 pattern templates
  • scripts/verify_patterns.ps1 - Compile examples for UNO/ESP32/RP2040 (PowerShell)
  • scripts/verify_patterns.sh - Compile examples for UNO/ESP32/RP2040 (bash)
  • assets/workflow.mmd - Mermaid diagram of code generation workflow

Supported Patterns

Hardware Abstraction

  • Multi-board config.h with conditional compilation
  • Pin definitions for UNO/ESP32/RP2040
  • Memory budget tracking

See patterns-config.md | Example: config-example.ino

Sensor Reading & Filtering

  • ADC noise reduction (moving average, median, Kalman)
  • DHT22, BME280, analog sensors
  • Data validation and calibration

See patterns-filtering.md | Example: filtering-example.ino

Input Handling

  • Software button debouncing
  • Edge detection (PRESSED/RELEASED/LONG_PRESS)
  • Multi-button management

See patterns-buttons.md | Example: buttons-example.ino

Communication

  • I2C device scanning and diagnostics
  • SPI configuration
  • UART/Serial protocols
  • CSV data output

See patterns-i2c.md and patterns-csv.md | Examples: i2c-example.ino, csv-example.ino

Timing & Concurrency

  • Non-blocking millis() patterns
  • Task scheduling without delay()
  • Priority-based schedulers
  • State machines

See patterns-scheduler.md and patterns-state-machine.md | Examples: scheduler-example.ino, state-machine-example.ino

Hardware Detection

  • Auto-detect boards (UNO/ESP32/RP2040)
  • SRAM usage monitoring
  • Sensor fallback strategies
  • Adaptive configuration

See patterns-hardware-detection.md | Example: hardware-detection-example.ino

Data Persistence

  • EEPROM with CRC validation
  • SD card FAT32 logging
  • Wear leveling for EEPROM
  • Buffered writes

See patterns-data-logging.md | Example: data-logging-example.ino

Code Generation Workflow

  • [ ] [Identify Pattern Type](workflow/step1-identify-pattern.md) - Analyze user request to determine core pattern category
  • [ ] [Read Reference Documentation](workflow/step2-read-reference.md) - Consult pattern-specific reference files for implementation details
  • [ ] [Generate Code](workflow/step3-generate-code.md) - Create production-ready code following quality standards
  • [ ] [Provide Instructions](workflow/step4-provide-instructions.md) - Include wiring diagrams and usage guidance
  • [ ] [Mention Integration](workflow/step5-mention-integration.md) - Suggest combinations with other patterns when relevant

Quality Standards & Rules

  • [ ] [Quality Standards](rules/quality-standards.md) - Compilation, timing, memory safety, and error handling requirements
  • [ ] [Board Optimization](rules/board-optimization.md) - UNO, ESP32, and RP2040 specific optimizations and features
  • [ ] [Common Pitfalls](rules/common-pitfalls.md) - Critical mistakes to avoid in Arduino development

Code Output Template

  • [ ] [Code Template](templates/code-output-template.md) - Standardized structure for generated Arduino sketches

Resources

  • examples/ - 9 production-ready example sketches (one per pattern category)
  • examples/README.md - Detailed documentation for each example with wiring diagrams
  • scripts/generate_snippet.py - CLI tool for code generation with 9 pattern templates
  • assets/workflow.mmd - Mermaid diagram of code generation workflow
  • workflow/ - Step-by-step code generation process
  • rules/ - Quality standards and board-specific optimizations
  • templates/ - Code output templates and structure guidelines
  • references/ - Detailed pattern documentation and API references
  • references/README.md - Reference structure and formatting guide

Shared Output Contract

Use the shared Arduino skill contract: state assumptions, required tools and versions, implementation steps, tests/evidence by proof stage, known limitations, and recovery/security notes.

按任务相关推荐

来自同一仓库

更多 Skills

全部 Skills
wedsamuel1230
社区

arduino-workflow-router

Route Arduino and embedded-system requests across Arduino IDE, Arduino CLI, PlatformIO, and vendor-specific tools. Use when a request combines firmware, board constraints, electronics, power, networking, calibration, enclosure, upload, debugging, OTA, or maintenance, or when the exact board or toolchain is not yet clear.

安装量
1
GitHub Stars
26
最近更新
10月15日
wedsamuel1230
社区

circuit-debugger

Systematic hardware debugging guide for Arduino/ESP32/RP2040 circuits. Use when user reports: circuit not working, components getting hot, no power, intermittent failures, unexpected behavior, sensor not responding, LED not lighting, motor not spinning. Guides through power checks, continuity testing, signal tracing, and component isolation using multimeter techniques.

安装量
1
GitHub Stars
26
最近更新
10月15日
wedsamuel1230
社区

datasheet-interpreter

Extracts key specifications from component datasheet PDFs for maker projects. Use when user shares a datasheet PDF URL, asks about component specs, needs pin assignments, I2C addresses, timing requirements, or register maps. Downloads and parses PDF to extract essentials. Complements datasheet-parser for quick lookups.

安装量
1
GitHub Stars
26
最近更新
10月15日
wedsamuel1230
社区

error-message-explainer

Explain Arduino and embedded compiler, upload, boot, power, and runtime errors in plain English. Use when a user shares an error or failure from Arduino IDE, Arduino CLI, PlatformIO, or a vendor-specific tool. Separate build, upload, hardware, and system evidence and give a board-specific recovery path without assuming UNO, ESP32, or RP2040 behavior.

安装量
1
GitHub Stars
26
最近更新
10月15日