From f3a5b90d090fda687adad44e37200fa446fcf7e0 Mon Sep 17 00:00:00 2001 From: EnricoGuccii Date: Sun, 11 May 2025 19:11:37 +0200 Subject: add motors --- lib/rgb/rgb.cpp | 6 +++++- lib/rgb/rgb.h | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'lib/rgb') 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); -- cgit v1.2.3