mirror of
https://github.com/Makuna/NeoPixelBus.git
synced 2025-08-10 22:34:25 +02:00
Updated FAQ #11 (markdown)
11
FAQ-#11.md
11
FAQ-#11.md
@@ -46,22 +46,21 @@ typedef NeoPixelBus<NeoGrbFeature, Neo800KbpsMethod> NeoPixelBusType;
|
|||||||
NeoPixelBusType strip(4, 2);
|
NeoPixelBusType strip(4, 2);
|
||||||
|
|
||||||
// example class using a reference; requires all code to be in the include
|
// example class using a reference; requires all code to be in the include
|
||||||
template<typename T_PIXEL_METHOD> class PixelRef {
|
class PixelRef {
|
||||||
public:
|
public:
|
||||||
PixelRef(T_PIXEL_METHOD& pixelStrip) :
|
PixelRef(NeoPixelBusType& pixelStrip) :
|
||||||
_strip(pixelStrip) {
|
_strip(pixelStrip) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Draw() {
|
void Draw() {
|
||||||
_strip.Show();
|
_strip.Show();
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
T_PIXEL_METHOD& _strip;
|
NeoPixelBusType& _strip;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
PixelRef myPixelRef(strip);
|
||||||
PixelRef<NeoPixelBusType> myPixelRef(strip);
|
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
strip.Begin();
|
strip.Begin();
|
||||||
|
Reference in New Issue
Block a user