2019-01-27 18:14:49 +01:00
2025-08-14 21:21:39 +02:00
2025-08-14 21:21:39 +02:00
2025-08-14 21:21:39 +02:00
2025-08-14 21:21:39 +02:00
2018-11-15 14:58:52 +01:00
2018-11-29 14:42:17 +01:00
2025-08-14 21:21:39 +02:00

Sprocket GPIO Plugin

A comprehensive GPIO plugin for the Sprocket framework, providing support for various input and output configurations on ESP8266 and ESP32 devices.

Overview

The GPIO plugin extends Sprocket-Core with flexible GPIO management capabilities, supporting multiple input types and configurations for IoT sensor applications.

Features

  • Multiple Input Types: Analog, digital, audio, and PIR sensor support
  • Configurable Pins: Flexible pin assignment and mode configuration
  • Event-Driven: Publishes sensor data to configurable topics
  • Task-Based: Integrated with Sprocket's task scheduler
  • Cross-Platform: Supports both ESP8266 and ESP32

Supported Input Types

Analog Inputs

  • Configurable threshold detection
  • Update interval control
  • Topic-based event publishing

Digital Inputs

  • Digital pin state monitoring
  • Event-driven state changes
  • Configurable pin modes

Audio Inputs

  • Audio signal processing
  • Threshold-based detection
  • Real-time audio monitoring

PIR Motion Sensors

  • Motion detection
  • Configurable sensitivity
  • Event publishing on motion

Configuration

struct GpioConfig {
    int pin;              // GPIO pin number
    int threshold;        // Detection threshold
    int updateInterval;   // Update frequency in ms
    const char *topic;    // Event topic for publishing
    int pinMode;          // Pin mode (INPUT, INPUT_PULLUP, etc.)
};

Usage Example

#include <GpioConfig.h>
#include <AnalogInputPlugin.h>

// Configure analog input
GpioConfig analogConfig = {
    .pin = A0,
    .threshold = 512,
    .updateInterval = 1000,
    .topic = "sensor/analog",
    .pinMode = INPUT
};

// Create and activate plugin
AnalogInputPlugin analogPlugin(analogConfig);
analogPlugin.activate(scheduler);

Installation

  1. Include the plugin in your Sprocket project
  2. Configure GPIO pins according to your hardware setup
  3. Initialize plugins with appropriate configurations
  4. Activate plugins through the Sprocket scheduler

Dependencies

  • Sprocket-Core framework
  • Arduino framework
  • TaskScheduler library

Platform Support

  • ESP8266
  • ESP32

Examples

See the examples/ directory for complete usage examples:

  • analog/ - Analog input configuration
  • audio/ - Audio input processing
  • combined/ - Multiple input types
  • pir/ - Motion sensor setup
  • rotary/ - Rotary encoder support

License

See LICENSE file for details.

Description
No description provided
Readme 176 KiB
Languages
C++ 80.2%
C 19.8%