Skip to content
Snippets Groups Projects
Commit f7dc36a5 authored by Orhan-Timo Altan's avatar Orhan-Timo Altan
Browse files

added 2 functions: set_brightness, get_pixel_color

parent 89a967ec
No related branches found
No related tags found
No related merge requests found
...@@ -10,6 +10,10 @@ void thk_LedStripController::init() { ...@@ -10,6 +10,10 @@ void thk_LedStripController::init() {
show(); show();
} }
void thk_LedStripController::set_brightness(uint8_t brightness) {
ptrStrip->setBrightness(brightness);
}
void thk_LedStripController::clear() { void thk_LedStripController::clear() {
ptrStrip->clear(); ptrStrip->clear();
} }
...@@ -27,6 +31,11 @@ void thk_LedStripController::set_pixel_color(uint16_t start_index, uint16_t amou ...@@ -27,6 +31,11 @@ void thk_LedStripController::set_pixel_color(uint16_t start_index, uint16_t amou
ptrStrip->fill(color, start_index, amount); 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() { void thk_LedStripController::show() {
ptrStrip->show(); ptrStrip->show();
} }
...@@ -120,7 +129,6 @@ void thk_LedStripController::running_light(unsigned long wait_time, uint8_t leng ...@@ -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. ptrStrip->show(); // Send the updated pixel colors to the hardware.
delay(wait_time); // Pause before next pass through loop delay(wait_time); // Pause before next pass through loop
Serial.println(last_pixel);
} }
clear(); clear();
show(); show();
......
...@@ -22,10 +22,12 @@ class thk_LedStripController { ...@@ -22,10 +22,12 @@ class thk_LedStripController {
thk_LedStripController(const uint16_t MAX_LED_NUMBER, const uint16_t DATA_PIN, uint8_t brightness = 64); thk_LedStripController(const uint16_t MAX_LED_NUMBER, const uint16_t DATA_PIN, uint8_t brightness = 64);
void init(); void init();
void clear(); 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);}; 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(uint32_t color);
void set_pixel_color(uint16_t index, 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); void set_pixel_color(uint16_t index, uint16_t amount, uint32_t color);
uint32_t get_pixel_color(uint16_t index);
void show(); void show();
uint32_t color_hsv(int pixelHue); uint32_t color_hsv(int pixelHue);
uint32_t gamma(int pixelHue); uint32_t gamma(int pixelHue);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment