Last weekend the MakerFaire Hannover 2014 took place, and the Arduino Group Hannover attended the Faire. Again Watterott was one of the exhibitors – it was clear, that this will be an expensive weekend ;-).
One of the things I bought was the NeoPixel Ring from Adafruit – a very nice toy!
In this article I will extract some of the documentation in the original neopixel library, so that I (and perhaps you) have it in one place without the disturbance of the actual code.
Some parts are directly copied from Adafruit_NeoPixel.h!!! These will shown italic.
Adafruit_NeoPixel(uint16_t numLEDs, uint8_t pin, uint8_t type)
Constructor:
- numLEDs: number of LEDs
- pin: the pin number the data in is connected at the Arduino. Default is 6
- type: the type of the NeoPixel device. Default is NEO_GRB + NEO_KHZ800. For the NeoPixel ring I used NEO_RGB + NEO_KHZ800
Example:
Adafruit_NeoPixel strip = Adafruit_NeoPixel(60, PIN, NEO_RGB + NEO_KHZ800);
void begin (void)
Sets output pin mode.
Example:
strip.begin ();
void show (void)
Shows the previously defined values.
Example:
strip.show ();
void setPixelColor (uint16_t n, uint8_t r, uint8_t g, uint8_t b)
Sets the the colour of one LED.
- n: number of LED
- r: red value
- g: green value
- b: blue value
Example:
strip.setPixelColor (i, 255, 128, 0);
void setPixelColor(uint16_t n, uint32_t c)
Sets the colour of one LED. This function uses the RGB values packed together into one 32 bit integer.
Example:
strip.setPixelColor (i, c);
uint32_t Color(uint8_t r, uint8_t g, uint8_t b)
Packs an RGB value into one 32 bit integer.
- r: red value
- g: green value
- b: blue value
Return value: the packed RGB value.
Example:
col = strip.Color(127, 0, 0)
uint32_t getPixelColor (uint16_t n)
Gets the colour of a previous set LED.
- n: number of LED
Return value: the packed RGB value of the LED.
Example:
col = strip.getPixelColor (i);
uint8_t *getPixels (void)
Returns pointer to pixels[] array. Pixel data is stored in device-native format and is not translated here. Application will need to be aware whether pixels are RGB vs. GRB and handle colors appropriately.
uint16_t numPixels (void)
Gets the number of LEDs. Return value: number of LEDs (what else ;-))
void setBrightness(uint8_t b)
Adjust output brightness; 0=darkest (off), 255=brightest. This does NOT immediately affect what’s currently displayed on the LEDs. The next call to show() will refresh the LEDs at this level.