Updated FAQ (markdown)

Michael Miller
2016-03-19 10:15:04 -07:00
parent 6f778eab16
commit a4bcf54fbd

63
FAQ.md

@@ -1,64 +1,9 @@
### I have connected this to my Esp8266 and nothing is shown and the Pin doesn't have any output. Using the NeoEsp8266BitBangMethod works fine though.
It is often missed that the DMA method ignores the passed in PIN and only works on GPIO3. The UART method also ignores the passed in PIN and only works on GPI02. Due to restrictions on the hardware used for these two methods there is no way to support other pins.
+ [I have connected this to my Esp8266 and nothing is shown and the Pin doesn't have any output. Using the NeoEsp8266BitBangMethod works fine though.](https://github.com/Makuna/NeoPixelBus/wiki/FAQ-%231)
### I have connected this to my Esp8266 (or other 3.3v based Arduino) and they don't show the colors correctly.
The effects you may see but are not limited to is the first or last pixels show incorrect colors, you see random flashes, or you see nothing.
This is due to the IO Pins on the device are 3.3v and the pixels require +-0.5v IO to there power voltage. Most pixels require 5v to run; so this puts the Pin IO out of spec. There are several solutions to this problem.
1) Make sure there isn't a 5v IO Pin on your device. A few lower voltage devices expose a compatible output pin just for this purpose. Switch to that Pin.
2) Use a level shifter in your design. [Adafruit sells one](https://www.adafruit.com/products/1875) that will work and you can find similar modules and circuits that you can incorporate. This will shift the 3.3v IO output to 5v for the pixels.
3) Lower the running voltage to your pixels to within range of the IO pins. Since the pixels need +-0.5v IO, if the primary voltage of the NeoPixel is 3.8v, then the 3.3v of the IO pin are within spec. Some pixels can run just fine at 3.8v and this is often the lowest rated voltage they can run at. The problem with this solution is how do you provide 3.8v at the current requirements the Pixels run at? You will need to get a variable power module and with a good meter set the voltage output to 3.8v. A lot more effort than just getting a level shifter.
For this reason I don't suggest this solution except for the bench testing.
+ [I have connected this to my Esp8266 (or other 3.3v based Arduino) and they don't show the colors correctly.](https://github.com/Makuna/NeoPixelBus/wiki/FAQ-%232)
### I wish to dynamically set the number pixels, other libraries expose a method to change the number of pixels like updateLength() or setPixelCount().
The key word here is dynamic. The best practice when dealing with key feature change is to dynamical create the object and recreate it when things change. It will often lead to smaller program code size even though you may have to type more. See the following snippet of code as an example of how to do this.
```
// declare your object as dynamic, a pointer to it, the *
// a good practice is to set it NULL
NeoPixelBus<NeoGrbFeature, Neo800KbpsMethod>* Strip = NULL;
+ [I wish to dynamically set the number pixels, but I don't see a way to do this and other libraries expose a method to change the number of pixels like updateLength() or setPixelCount().](https://github.com/Makuna/NeoPixelBus/wiki/FAQ-%233)
// inside setup, allocate your default, or maybe you don't do this and just wait for outside influence
Strip = new NeoPixelBus<NeoGrbFeature, Neo800KbpsMethod>(PixelCount, Pin); // this dynamically creates one
Strip->Begin(); // since its a dynamic object pointer, you need to use -> instead of just a period
// latter in your code, due to some outside influence, you need to change the pixel count
if (Strip != NULL) {
delete Strip; // delete the previous dynamically created strip
}
Strip = new NeoPixelBus<NeoGrbFeature, Neo800KbpsMethod>(newCount, Pin); // and recreate with new count
Strip->Begin();
// other parts of your code, you set the colors, and show
Strip->SetPixelColor(0, RgbColor(0));
Strip->Show();
```
### How can I convert Hsl to Rgb and/or just set the colors with Hsl?
There is a HslColor object that will automatically convert to any of the other color object by just assigning them.
```
HslColor myColor(0.244f, 1.0f, 0.5f);
RgbColor rgbOfMyColor = myColor;
```
Further, all the color objects can be used by the SetPixelColor().
```
HslColor myColor(0.244f, 1.0f, 0.5f);
strip.SetPixelColor(0, myColor);
```
The only limitation is that the RgbwColor can not be used directly with a NeoPixelBus defined with a 3 element feature like NeoRgbFeature or NeoGrbFeature. This is due to the loss of color that could happen. So the following will create a compile error.
```
NeoPixelBus<NeoGrbFeature, Neo800KbpsMethod> strip(2,2);
...
RgbwColor myColor(124, 64, 124, 10);
strip.SetPixelColor(0, myColor); // compiler error
```
The issue is what does it mean to convert RGBW value to just RGB? How is the white handled in the conversion? There is no standard to how this should be done so it is left to you for your application.
You could just ignore the white like below.
```
RgbwColor myColor(124, 64, 124, 10);
RgbColor myRgbColor(myColor.R, myColor.G, myColor.B); // converted ignore the white
```
Or you could blend the white in as demonstrated by this simple example.
```
RgbwColor myColor(124, 64, 124, 10);
RgbColor myRgbColor(myColor.R + myColor.W, myColor.G + myColor.W, myColor.B + myColor.W); // blend in white
```
+ [How can I convert Hsl to Rgb and/or just set the colors with Hsl?](https://github.com/Makuna/NeoPixelBus/wiki/FAQ-%234)