#ifndef SimpLedRGB_h #define SimpLedRGB_h #include "Arduino.h" typedef struct { float red; float green; float blue; } Color; const Color COLOR_CANDLE = {1.0, 0.5, 0.0}; const Color COLOR_VIOLET = {1.0, 0.0, 1.0}; const Color COLOR_GREEN = {0.0, 1.0, 0.0}; const Color COLOR_CYAN = {0.0, 0.5, 1.0}; const Color COLOR_RED = {1.0, 0.0, 0.0}; const Color COLOR_YELLOW = {1.0, 1.0, 0.0}; const Color COLOR_ORANGE = {1.0, 0.5, 0.0}; const Color COLOR_BLUE = {0.0, 0.0, 1.0}; class SimpLedRGB { int pin_red = 0; int pin_green = 0; int pin_blue = 0; const double PULSE_PER_SECOND = ((PI * 2) / 1000.0); Color color = {0.0, 0.0, 0.0}; public: SimpLedRGB(int pinRed, int pinGreen, int pinBlue); void begin(); void setColor(const Color &color); void translateToColor(const Color &color, int duration_millis); void rainbowCycle(int cycleDurationMillis); void candle(const Color &color, float wind = 0.5); void pulse(const Color &color, float timesPerSecond = 1.0, float amplitudeMin = 0.0, float amplitudeMax = 1.0); }; #endif