What data type do I use to store a function to a variable?

Hi Everyone,

What data type would I use to store this function to a variable? I'm using the Adafruit Neopixel library.

I know that when I assign a single "pixels.setPixelColor..." to a variable I should the uint32_t data type; is that the case here as well?

void green_blue(){
// Outside LEDs
   pixels.setPixelColor(0, pixels.Color(0,200,0)); // Green
   pixels.setPixelColor(1, pixels.Color(0,200,0));
// Inside LEDs
   pixels.setPixelColor(2, pixels.Color(0,0,127)); // Blue
   pixels.setPixelColor(3, pixels.Color(0,0,127));
   pixels.show(); 
}

Any help would be greatly appreciated.

Cheer, Cody

You can't store a function in a variable. You could store a pointer to the function, but I don't think that is what you want to do.

pixels.Color() returns a uint32_t, if that is what you are asking.

PaulS: You can't store a function in a variable. You could store a pointer to the function, but I don't think that is what you want to do.

pixels.Color() returns a uint32_t, if that is what you are asking.

Thank you for your reply, Paul.

Sorry, I'm a little confused. I was having a look at the documentation for functions on the Arduino website and it shows:

"To call our function we just assign it to a variable."

int sens;

sens = ReadSens_and_Condition();

I'm missing something here, sorry.

Cody

That stores the value that the function ReadSens_and_Condition() RETURNS in the variable "sens".