Makuna / NeoPixelBus

An Arduino NeoPixel support library supporting a large variety of individually addressable LEDs. Please refer to the Wiki for more details. Please use the GitHub Discussions to ask questions as the GitHub Issues feature is used for bug tracking.
GNU Lesser General Public License v3.0
1.17k stars 257 forks source link

Compilation error on example sketch NeoPixelCylon #192

Closed pacobyte closed 6 years ago

pacobyte commented 6 years ago

Arduino IDE version: v1.8.5 Board: Arduino UNO LED Chipset: SK6812 RGBW, 60 count

Having just found this library today, I've been loading the examples one by one to learn how to use it. Things have been going smoothly until I tried to upload the NeoPixelCylon sketch to my Uno. What seems to be the important part of the error message is:

NeoPixelCylon:43: error: no match for 'operator=' (operand types are 'RgbColor' and 'Neo4Elements::ColorObject {aka RgbwColor}')

If you think it will help, I can include the whole compilation error output here.

Unfortunately, I've never really messed around with C/C++, so I'm clueless on how to fix this.

Makuna commented 6 years ago

Did you compile the sketch without modification? What modification did you make?

I suspect you changed the NeoGrbFeature to NeoGrbwFeature (or something similar with a W in it).

In this case, the line where the error is at is color = strip.GetPixelColor(indexPixel); The issue is that the variable is a RgbColor, but your strip wants to return a RgbwColor and if it auto-converted it would be a loss of data (the W part) so it is a compiler error. Just change the type of the variable color to a RgbwColor.

pacobyte commented 6 years ago

Excellent, thank you. Changing the type of color to an RgbwColor worked perfectly.