LED Feedback Component Documentation
LED Feedback
Section titled “LED Feedback”Path: src/LEDFeedback.cpp
Revision History: Initial documentation
The LED Feedback component provides visual status indication through addressable LED strips (NeoPixel compatible). It offers multiple display modes including fading effects, level indicators, and tri-color blinking patterns that can be controlled via Modbus.
REQUIREMENTS
Section titled “REQUIREMENTS”- Digital output pin connected to WS2812B/SK6812 compatible LED strip
- 5V power supply for the LED strip (separate from microcontroller logic)
- Modbus TCP connection for remote control
FEATURES
Section titled “FEATURES”- Multiple display modes:
- OFF: All LEDs turned off
- FADE_R_B: Smooth color transition between red and blue
- RANGE: Level indicator (0-100%) using lit LEDs
- TRI_COLOR_BLINK: Three-section traffic light style blinking (red, yellow, green)
- Modbus control interface for mode selection and parameters
- Adjustable update rate for animations
- Configurable pixel count to support different strip lengths
DEPENDENCIES
Section titled “DEPENDENCIES”- Adafruit_NeoPixel - Library for controlling addressable LED strips
- ArduinoLog - Logging functionality
- ModbusTCP - For Modbus communication
BEHAVIOUR
Section titled “BEHAVIOUR”PERFORMANCE
Section titled “PERFORMANCE”- Consider power consumption optimization for battery-powered applications
- Investigate using DMA-based LED control to reduce CPU usage
- Add brightness control via Modbus to manage power usage
SECURITY
Section titled “SECURITY”- Validate Modbus values more strictly to prevent unexpected behavior
- Consider adding access control for mode changes
COMPLIANCE
Section titled “COMPLIANCE”- Verify EMC compliance when LEDs change rapidly (potential for EMI)
- Ensure ADA compliance for visual indicators in public/commercial settings
RECOMMENDATIONS
Section titled “RECOMMENDATIONS”- Use adequate power supply for LED strips (60mA per pixel at full brightness)
- Consider adding a level-shifting circuit when connecting 3.3V microcontrollers to 5V LED strips
- Add physical protection for LEDs in industrial environments
- Implement custom modes for specific application requirements
EXAMPLE
Section titled “EXAMPLE”This example shows how to initialize and mount an LED Feedback component in an application:
#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); } else { Log.errorln(F("LEDFeedback_0 initialization failed.")); }#endif