I am working on a project including a load sensor and HX711 load cell amplifier so that when a certain weight is placed on it, the neopixel ring either lights up red or green.

The load sensor is working and so is the neopixel ring, separately. When I try to use them together, the Neopixel turns on, but never changes color when I add different weights.

I am struggling with my if/for statements and would love to hear your input/solutions, as this project must be finished by next week.

Thanks for all of your help!

dogbowlCODE2018.ino (2.13 KB)

When posting code, put it inline using code tags ( </> button), instead of attaching the sketch. That way we don’t have to download it - particularly since many of us post from cellphones where downloading and opening a sketch is obnoxious. I still haven’t figured out how to associate .ino with a text editor so I can view them on my phone.

Your problem is that you have scale.get_units() in quotes when you’re testing it. Remove those quotes, and it should work.

Also, switch the for and if statements, ie,

if (scale.get_units > 3) {
for (byte i = 0;i<NUMPIXELS;i++) {pixels.setPixelColor(i,255,0,0);};
} else if (…)

That way you’re not reading the scale for every pixel.

Also, you realize that if the reading is under 1, nothing will happen, and the colors will not be changed - is that intended?