NeoPixel Shield examples

Adafruit Ethernet, Motor, Proto, Wave, Datalogger, GPS Shields - etc!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
JesssB
 
Posts: 4
Joined: Fri Sep 26, 2014 5:39 pm

NeoPixel Shield examples

Post by JesssB »

Hi,
I have recently purchased a NeoPixel Shield, downloaded all the libraries for it, read the guide and tried the examples, but I still don't know how to program the LEDs separately. The examples create a scrolling text, but how do I assign a specific color and an ON/OFF function to only one LED? I want to eventually create a drawing touch pad for which the display will be the NeoPixel Shield.

Thanks!

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

Re: NeoPixel Shield examples

Post by Franklin97355 »

The commands to set pixel color are in the .h and .cpp files. You can look to see how they are used in the code. I pulled out a list of the functions here

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)
Adafruit_NeoPixel::~Adafruit_NeoPixel() 
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) const 
uint8_t *Adafruit_NeoPixel::getPixels(void) const 
uint16_t Adafruit_NeoPixel::numPixels(void) const 
void Adafruit_NeoPixel::setBrightness(uint8_t b) 

User avatar
JesssB
 
Posts: 4
Joined: Fri Sep 26, 2014 5:39 pm

Re: NeoPixel Shield examples

Post by JesssB »

Nice, I'll look at it. But also, how do I set a pixel to light up? Like in the 16x32 matrix examples, using the RGB_matrix_Panel library, you have a matrix.setPixel(x, y, color) command. Anything like that for the NeoPixel shield?

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

Re: NeoPixel Shield examples

Post by Franklin97355 »

setPixelColor(uint16_t n, uint32_t c) and then show()

User avatar
pburgess
 
Posts: 4161
Joined: Sun Oct 26, 2008 2:29 am

Re: NeoPixel Shield examples

Post by pburgess »


User avatar
JesssB
 
Posts: 4
Joined: Fri Sep 26, 2014 5:39 pm

Re: NeoPixel Shield examples

Post by JesssB »

Again, thanks for the response, but at the risk of sounding very stupid, I am not sure I know what n and c stand for. I guess c stands for color. But then how do I define it from RGB values to one number? And what is n? Would that be the position? If so, how does it work? I have never programmed anything in bits and bytes like this.

User avatar
JesssB
 
Posts: 4
Joined: Fri Sep 26, 2014 5:39 pm

Re: NeoPixel Shield examples

Post by JesssB »

Oh my god, after a week of trying to figure out how to work with the shield, and trying out every bit of very useful information you guys wrote here, I made it! Figured out how to define the position of each pixel, and used RGB values instead of uint32_t. I have never been that happy to see a single red LED turning on in my life! Haha!

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

Return to “Arduino Shields from Adafruit”