firmware-base/docs/components/LEDFeedback.md
2025-06-03 16:21:36 +02:00

58 lines
1.7 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: LEDFeedback Component
description: Documentation for the LEDFeedback component used in ESP-32, Platform.io, C17 for industrial applications with Modbus-485.
keywords: ESP-32, Platform.io, C17, Modbus-485, LEDFeedback, NeoPixel
---
## LEDFEEDBACK
**Path**: [../src/components/LEDFeedback.h](../src/components/LEDFeedback.h)
**Revision History**: Initial documentation
This component controls an LED strip (NeoPixel) with various modes like fade, range display, and tri-color blink. It integrates with Modbus for industrial control.
## REQUIREMENTS
- **Pins**: Data pin for NeoPixel (configurable via `PIN_LED_FEEDBACK`).
- **Dependencies**:
- `Adafruit_NeoPixel` library for LED control.
- ModbusTCP library for communication.
- `config.h` and `config-modbus.h` for configurations.
## FEATURES
- Multiple LED modes (OFF, Fade Red-Blue, Range display, Tri-Color Blink).
- Modbus integration for remote control and monitoring.
- Configurable LED strip parameters (pin, pixel count, Modbus address).
## TODOS
- Add more LED modes (e.g., SOLID_COLOR, RAINBOW).
- Implement brightness control via Modbus.
- Enhance error handling in Modbus communication.
## EXAMPLE
```cpp
#ifdef PIN_LED_FEEDBACK_0
ledFeedback_0 = new LEDFeedback(
this, // owner
PIN_LED_FEEDBACK_0, // pin
LED_PIXEL_COUNT_0, // pixelCount
ID_LED_FEEDBACK_0, // id
LED_FEEDBACK_0_MB_ADDR // modbusAddress
);
if (ledFeedback_0)
{
components.push_back(ledFeedback_0);
Log.infoln(F("LEDFeedback_0 initialized. Pin:%d, Count:%d, ID:%d, MB:%d"),
PIN_LED_FEEDBACK_0, LED_PIXEL_COUNT_0,
ID_LED_FEEDBACK_0, LED_FEEDBACK_0_MB_ADDR);
}
z[
{
Log.errorln(F("LEDFeedback_0 initialization failed."));
}
#endif
```