0

Neopixel Library Reference?
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Neopixel Library Reference?

by jflorkow on Mon May 19, 2014 6:11 pm

Maybe I am just blind, but I am looking for a reference listing each method in the Adafruit Neopixel Library, what it does, and what parameters it expects.
Forgive me if this is in some obvious place, but this is my first time using an arduino library and I have never used Github before either.
Thank you!

jflorkow
 
Posts: 1
Joined: Sat Sep 22, 2012 4:54 pm

Re: Neopixel Library Reference?

by pburgess on Wed May 21, 2014 2:39 am

The NeoPixel Überguide runs through the basics of the library:
https://learn.adafruit.com/adafruit-neo ... no-library

You can also pick apart the code from some of the NeoPixel projects (goggles, etc.) for examples of the library in use.

pburgess
 
Posts: 3961
Joined: Sun Oct 26, 2008 2:29 am

Re: Neopixel Library Reference?

by cbabbage on Mon Feb 12, 2018 9:20 pm

Yeah, I know this is an old post, but the situation has not changed. I have to assume that folks have forgotten what documentation is. In the Unix world, they used to call these things "man pages". (That's sexist, these days, I'm sure...) What's needed is a list of all the function calls (or, maybe "methods" or some other fashionable OO word) that are exposed to the user by the library. Each entry should describe the name of the function call, the parameters it expects, what the parameters mean, what the function returns. There should also be a couple of realistic examples that demonstrate the use of the function. And if you put these entries in alphabetical order, then you have something really useful. It's called a "reference".

For example, looking at the provided example for the Adafruit_NeoPixel library, I can immediately figure out what a lot of the calls do. For example,
Code: Select all | TOGGLE FULL SIZE
strip.setBrightness(BRIGHTNESS)
is pretty obvious--in a general way. From what I've skimmed, I suspect that the entire strip does not light up when the code execution gets to this line, however. Something else has to happen...maybe it's
Code: Select all | TOGGLE FULL SIZE
strip.show()
. But as a beginner trying to figure out how to work with Neopixels, I shouldn't have to guess.

I'm sure I'll figure out eventually just what
Code: Select all | TOGGLE FULL SIZE
 strip.setPixelColor(i, strip.Color(0,0,0, neopix_gamma[j] ) );
does, but again, it would be nice not to have to guess, but to look at a reference. I'd expect a function that sets a pixel color to have parameters for the pixel number, the color values, and maybe brightness. Why is the call to
Code: Select all | TOGGLE FULL SIZE
strip.Color
a parameter?

Obviously, I'm ignorant. I've just started messing with this stuff today, and I'm not smart enough to read the library code and figure it all out quickly. If I was, I'd write my own library. My point is that a "man page" for the library would be really super helpful in getting me off to a running start. And I'd use it later also, when I've forgotten something, or am wondering "Isn't there maybe a function that does x?".) I think there are plenty of other people who would agree with me.

cbabbage
 
Posts: 2
Joined: Mon Feb 12, 2018 8:51 pm

Re: Neopixel Library Reference?

by abowers87 on Sun Feb 18, 2018 2:01 pm

That is a criticism I would level on Adafruit: "Download and install the Adafruit Widget python library, copy/paste the example code, and you're good to go!" You are indeed, if you're building the exact thing in the tutorial. For those building unique projects, a general purpose API that simply lists the functions in a library and describes their behavior and methods would be handy, one of my favorites is the Raspberry Pi Sense Hat API. Quite a few Adafruit products communicate via I2C or SPI, so sometimes it would be more expedient to just know what data the device is looking for/sending than to have an undocumented library and a single example script to pick apart, and use standard libraries for communication rather than rely on special ones.

It would also better serve Adafruit's mission as an educator, weaning learner electricians and programmers off of step-by-step tutorials and into reading and interpreting manuals and documentation.

abowers87
 
Posts: 2
Joined: Sat Feb 17, 2018 5:31 pm

Re: Neopixel Library Reference?

by kcl1s on Sun Feb 18, 2018 5:00 pm

I agree completely. It is not just adafruit but most arduino libraries. The Arduino community is great but the learn by using examples only mentality is tough! Arduino.cc does a good job with the base libraries but nearly everyone else does not. One example of great docs is Tim Eckel's NewPing library. https://bitbucket.org/teckel12/arduino-new-ping/wiki/Home

I can understand a hobbyist that makes a library for their own use not to document it well but then decide to put it online because others might find it useful. A company like Adafruit has no excuse not to at least do minimum docs. for their libraries. I had the same issue when they started Circuit Phython but they seem to be trying to document it better with their Read the Docs pages https://circuitpython.readthedocs.io/en/2.x/

Keith

kcl1s
 
Posts: 857
Joined: Tue Aug 30, 2016 12:06 pm

Re: Neopixel Library Reference?

by cbabbage on Sun Feb 18, 2018 8:22 pm

I found a solution of sorts: I'm using the fastLED library, on the basis of documentation alone. They have a wiki that is pretty good, and has gotten me off to a running start. For example: https://github.com/FastLED/FastLED/wiki/Basic-usage

Dunno why anybody would want to use Python rather than C/C++ though... but to each his own :)

cbabbage
 
Posts: 2
Joined: Mon Feb 12, 2018 8:51 pm

Re: Neopixel Library Reference?

by Jimlowing on Thu Apr 19, 2018 12:05 pm

Neopixel Library Reference? How can a function/command reference not exist? This is just arrogant.

Jimlowing
 
Posts: 1
Joined: Thu Apr 19, 2018 12:00 pm

Re: Neopixel Library Reference?

by All_In_One_Mighty on Thu Apr 19, 2018 1:27 pm


All_In_One_Mighty
 
Posts: 16
Joined: Thu Mar 15, 2018 4:22 am

Please be positive and constructive with your questions and comments.