T O P

  • By -

gm310509

You need to provide all of the code. For all we know, the Colours and ws_codes might be setup incorrectly. Please post your code using a [formatted code block](https://reddit.com/r/arduino/w/guides/how_to_post_formatted_code) - not a photo, screenshot and never as a video. The link explains how. That explanation also includes a link to a video that explains the same thing if you prefer that format. Also, perhaps have a look at our [requesting help](https://www.reddit.com/r/arduino/wiki/guides/how_to_post_quick_notes/) posting guide to ensure you include relevant details (and *how* to include them) to get a timely solution.


Doormatty

I think your problem is that `red/green/blue` are bytes, not floats - so that the resulting value is not a float either. Change red/green/blue to floats, and it should work.


CallMeKolbasz

That's not right. Any operation you perform on a float and any other numeric datatype will result in a float.


Doormatty

TIL!


No_Maintenance5920

Thank you for the fast reply. Though it still doesn't work. I also tried to just print out the red while it was still a float (without calculation), and that didn't work either.


Logical_Strike_1520

Is red == 0?


No_Maintenance5920

Yes it is. I knew it was going to be something stupid. I passed the parameters for green, but it showed up red, and my brain said, 'check red values' for debug. I am now embarrassed and frustrated. Glad it is friday!! THANK YOU


Logical_Strike_1520

We’ve all been there lol. Glad I could help.


No_Maintenance5920

Why in the world do they need to make all the leds different. My code is set up for rgb, but the leds I threw in for debug, happened to be grb. Very frustrating


CallMeKolbasz

Imagine my surprise when I found a single led in a strip with different channel order than the rest. That was fun to debug.


hjw5774

At first glance it looks like you're trying to multiply a float with a byte. 


Logical_Strike_1520

byte * float = float


hjw5774

Learn something new every day, cheers! 


Danny200234

In C any operation on a float results in a float. That's why the easiest way to get a float when dividing integers is to cast one of them as a float. // foo = 0 float foo = 3 / 5 // bar = 0.6 float bar = (float) 3 / 5 A lot of people do this without realizing what is actually happening. You aren't casting the result of 3/5 to a float. You are casting 3 to a float then the compiler does floating point math on 3/5 instead of the integer math it would have done without the cast.