diff --git a/thk_ledstrip_controller.cpp b/thk_ledstrip_controller.cpp index 6f441f1b477b978e8754cbd4e1d1ba23e5394893..6ac5fc0da03619b3097b66f3240ac6294b1a510d 100644 --- a/thk_ledstrip_controller.cpp +++ b/thk_ledstrip_controller.cpp @@ -10,6 +10,10 @@ void thk_LedStripController::init() { show(); } +void thk_LedStripController::set_brightness(uint8_t brightness) { + ptrStrip->setBrightness(brightness); +} + void thk_LedStripController::clear() { ptrStrip->clear(); } @@ -27,6 +31,11 @@ void thk_LedStripController::set_pixel_color(uint16_t start_index, uint16_t amou ptrStrip->fill(color, start_index, amount); } +uint32_t thk_LedStripController::get_pixel_color(uint16_t index) { + uint32_t pixel_color = ptrStrip->getPixelColor(index); + return pixel_color; +} + void thk_LedStripController::show() { ptrStrip->show(); } @@ -120,7 +129,6 @@ void thk_LedStripController::running_light(unsigned long wait_time, uint8_t leng ptrStrip->show(); // Send the updated pixel colors to the hardware. delay(wait_time); // Pause before next pass through loop - Serial.println(last_pixel); } clear(); show(); diff --git a/thk_ledstrip_controller.h b/thk_ledstrip_controller.h index eb8f6c1df2ea277962aeda9dfa305459a9dc9a0b..9db21be734d572ebe5a5ed3a767db728ab867195 100644 --- a/thk_ledstrip_controller.h +++ b/thk_ledstrip_controller.h @@ -22,10 +22,12 @@ class thk_LedStripController { thk_LedStripController(const uint16_t MAX_LED_NUMBER, const uint16_t DATA_PIN, uint8_t brightness = 64); void init(); void clear(); + void set_brightness(uint8_t brightness); static uint32_t Color(uint8_t red, uint8_t green, uint8_t blue) { return Adafruit_NeoPixel::Color(red, green, blue);}; void set_pixel_color(uint32_t color); void set_pixel_color(uint16_t index, uint32_t color); void set_pixel_color(uint16_t index, uint16_t amount, uint32_t color); + uint32_t get_pixel_color(uint16_t index); void show(); uint32_t color_hsv(int pixelHue); uint32_t gamma(int pixelHue);