Using libraries

General project help for Adafruit customers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
djubee1
 
Posts: 5
Joined: Sun Mar 30, 2014 11:26 pm

Using libraries

Post by djubee1 »

Hi. I know that to some of the products here require the use of libraries. For example, NeoPixels. I started using the sample code that is included with the library; however, my question is: What is in the NeoPixel Library that can be used to program the NeoPixels? I can't find any reference to what is actually inside the library. I searched the reference guide for the NeoPixels too, but did not seem to find anything. Can anyone help? I would appreciate the guidance. Thanks.

User avatar
Franklin97355
 
Posts: 23911
Joined: Mon Apr 21, 2008 2:33 pm

Re: Using libraries

Post by Franklin97355 »

The library is the .h and .cpp files inside the library folder. Sometimes there is also a keywords file but beyond that reference materials are slim. Someday a bunch of Adafruit's friends (us) will decide to document them but don't hold your breath.

djubee1
 
Posts: 5
Joined: Sun Mar 30, 2014 11:26 pm

Re: Using libraries

Post by djubee1 »

Is there a reference guide on the commands that are available in the NeoPixel library? Or is there a way to program the pixels without the library?

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: Using libraries

Post by adafruit_support_mike »

The NeoPixel Uberguide has all the general information about working with them: https://learn.adafruit.com/adafruit-neo ... e/overview

We don't have an explicit reference to the NeoPixel library because there are only about 10 functions in the library, and most of the critical code had to be written in ATmega assembler to get the timing right. The examples that come with the library show how to work with NeoPixels, and in practice a working example is as good a form of documentation as anything: https://github.com/adafruit/Adafruit_Ne ... r/examples

User avatar
Franklin97355
 
Posts: 23911
Joined: Mon Apr 21, 2008 2:33 pm

Re: Using libraries

Post by Franklin97355 »

These are the commands from the .cpp file

Code: Select all

Adafruit_NeoPixel::Adafruit_NeoPixel(uint16_t n, uint8_t p, uint8_t t) : numLEDs(n), numBytes(n * 3), pin(p), pixels(NULL)
void Adafruit_NeoPixel::begin(void) 
void Adafruit_NeoPixel::show(void)
void Adafruit_NeoPixel::setPin(uint8_t p)
void Adafruit_NeoPixel::setPixelColor(uint16_t n, uint8_t r, uint8_t g, uint8_t b)
void Adafruit_NeoPixel::setPixelColor(uint16_t n, uint32_t c)
uint32_t Adafruit_NeoPixel::Color(uint8_t r, uint8_t g, uint8_t b)
uint32_t Adafruit_NeoPixel::getPixelColor(uint16_t n)
uint8_t *Adafruit_NeoPixel::getPixels(void)
uint16_t Adafruit_NeoPixel::numPixels(void)
void Adafruit_NeoPixel::setBrightness(uint8_t b)
 

djubee1
 
Posts: 5
Joined: Sun Mar 30, 2014 11:26 pm

Re: Using libraries

Post by djubee1 »

I appreciate the information. You made my day today! :)

Locked
Please be positive and constructive with your questions and comments.

Return to “General Project help”