mirror of
https://github.com/Makuna/NeoPixelBus.git
synced 2025-08-09 22:04:27 +02:00
Updated FAQ #11 (markdown)
@@ -1,4 +1,4 @@
|
|||||||
### How do store a reference to the NeoPixelBus in another class?
|
### How do I store a reference to the NeoPixelBus in another class?
|
||||||
|
|
||||||
Since the NeoPixelBus is a template class; you can't just store a reference to it using older models. But there are two ways to accomplish this.
|
Since the NeoPixelBus is a template class; you can't just store a reference to it using older models. But there are two ways to accomplish this.
|
||||||
|
|
||||||
@@ -10,13 +10,11 @@ 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 template class using a reference; requires all code to be in the include
|
||||||
template<typename T_PIXEL_METHOD> class PixelRef
|
template<typename T_PIXEL_METHOD> class PixelRef {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
PixelRef(T_PIXEL_METHOD& pixelStrip) :
|
PixelRef(T_PIXEL_METHOD& pixelStrip) :
|
||||||
_strip(pixelStrip) {
|
_strip(pixelStrip) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Draw() {
|
void Draw() {
|
||||||
|
Reference in New Issue
Block a user