roo_blink
API Documentation for roo_blink
Loading...
Searching...
No Matches
adafruit_neopixel_led.h
Go to the documentation of this file.
1#pragma once
2
3#include "Adafruit_NeoPixel.h"
4#include "roo_blink/rgb/led.h"
5
6namespace roo_blink {
7
8/// RGB LED backed by an Adafruit_NeoPixel instance.
9class NeoPixelLed : public RgbLed {
10 public:
11 /// Creates a wrapper for a specific NeoPixel index.
12 NeoPixelLed(Adafruit_NeoPixel& neopixel, int led_idx = 0)
13 : neopixel_(neopixel), led_idx_(led_idx) {}
14
15 /// Sets the color and immediately updates the strip.
16 void setColor(Color color) override {
17 neopixel_.setPixelColor(led_idx_, color.r(), color.g(), color.b());
18 neopixel_.show();
19 }
20
21 private:
22 Adafruit_NeoPixel& neopixel_;
23 int led_idx_;
24};
25
26} // namespace roo_blink