Arduino IDE - LED Sketch question

I am an absolute beginner to Arduino Uno, which I bought to control some Individually addressable LEDs. I have been downloading pre-written code and changing things to see what happens... however, I have come across one sketch that will not compile... I would like to use it and wonder if someone could help me fix this. I am sure it is an easy answer but I don't know enough to work it out. In the following sketch an error occurs when compiling which says ''setPixel' was not declared in this scope' and highlights this text near the bottom of the sketch ' setPixel(Position[i], red, green, blue);' As a complete beginner I think it is something that needs setting in the void setup section of the sketch... or am I completely wrong? Any help will be appreciated.

Please read the forum guide and then edit and fix your post above before the forum moderators see it, it's breaking forum rules about posting code (hint: no code tags).

Try this

leds[Position[i]] = CRGB( red, green, blue);

Read the forum guidelines to see how to properly post code.
Use the IDE autoformat tool (ctrl-t or Tools, Auto format) before posting code in code tags.

Please include the entire error message. It is easy to do. There is a button (lower right of the IDE window) called "copy error message". Copy the error and paste into a post in code tags. Paraphrasing the error message leaves out important information.

Learn to make a proper comment. // is right, / just causes us more work to try to get the code to compile.

 setPixel(Position[i], red, green, blue);

replace that with the line @ PaulRB posted. Or find the setPixel function that is missing.

showStrip' was not declared in this scope
Shouldn't that be;? Or is there supposed to be a showStrip function (that is missing)?

 setAll(0, 0, 0);

Another missing function? You might use the fillSolid library function:

fill_solid (struct CRGB *leds, int numToFill, const struct CRGB &color);

Thank you both. I will try that... I have removed the code and will format it correctly and put it back in. Thank you for the advice and guidance.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.