summaryrefslogtreecommitdiff
path: root/lib/rgb
diff options
context:
space:
mode:
authorEnricoGuccii <partyka.003@gmail.com>2025-05-11 19:11:37 +0200
committerEnricoGuccii <partyka.003@gmail.com>2025-05-11 19:11:37 +0200
commitf3a5b90d090fda687adad44e37200fa446fcf7e0 (patch)
treeb7c432c13d4427cc2622c9b149522a97db55b302 /lib/rgb
parentcf9a1f07ed519cadd58e38794616d0a9596be4ae (diff)
add motors
Diffstat (limited to 'lib/rgb')
-rw-r--r--lib/rgb/rgb.cpp6
-rw-r--r--lib/rgb/rgb.h1
2 files changed, 6 insertions, 1 deletions
diff --git a/lib/rgb/rgb.cpp b/lib/rgb/rgb.cpp
index 249e7f0..e66d264 100644
--- a/lib/rgb/rgb.cpp
+++ b/lib/rgb/rgb.cpp
@@ -14,8 +14,12 @@ int RGB::scaleColor(uint8_t val)
{
return map(val, 0, 255, 0, (1 << PWM_RES) - 1);
}
-
RGB::RGB()
+ : currentR(0), currentG(0), currentB(0)
+{
+}
+
+void RGB::init()
{
ledcSetup(RED_CHANNEL, PWM_FREQ, PWM_RES);
ledcAttachPin(RED_PIN, RED_CHANNEL);
diff --git a/lib/rgb/rgb.h b/lib/rgb/rgb.h
index 3850f0a..fddeae8 100644
--- a/lib/rgb/rgb.h
+++ b/lib/rgb/rgb.h
@@ -11,6 +11,7 @@ public:
uint8_t currentB;
RGB();
+ void init();
void setColorRGB(uint8_t red, uint8_t green, uint8_t blue, bool saveColor);
void fadeColor(uint8_t red, uint8_t green, uint8_t blue, int duration);
void blink(int cycles, int interval);