c++ - How do I call functions before setup? Or make a neopixels initializer before setup? [arduino] -
i need hand. i'm trying figure out how shuffle neopixel pins. right now, have function shuffles pins, don't know how define pins , start strips. i've got pastebin of have on here:
basically what's stumping me this:
neopatterns strip1(32, neopixelpins[0], neo_grb + neo_khz800, &stripcomplete);
i can't move setup function. can't after shufflepins() in setup, , can't move strip1.begin() etc out of function or start of loop().
so. how can this? need first shuffle pins, define strips, start them. needs reusable, because @ end of game, re-shuffles pins , starts over.
i'm going have read through this: call function before main
but if can give me hand this, appreciate it. i'm new c++.
reference on neopatterns class came from: https://learn.adafruit.com/multi-tasking-the-arduino-part-3/using-neopatterns
thanks!
you want shuffle pin numbers, want before constructor called, it?
much more simply, call adafruit_neopixel::setpin
in setup, once have shuffled pins. can pass old pin numbers in constructor, , change them.
i'm going have read through this: call function before main
don't go down path, unnecessarily complicated.
can toss example adafruit_neopixel::setpin in setup?
something this:
strip1.begin(); strip2.begin(); strip3.begin(); strip1.setpin (3); // or whatever strip2.setpin (4); strip3.setpin (5);
i gave simple example, can shuffling , stuff resulting pins 3 function calls. don't have worry shuffling before make strip1/strip2/strip3.
Comments
Post a Comment