LDR Light sensor

Hi all, I am brand new to this site, and getting familiar with Arduino and WS2812 led light strips.
have a problem that I can not figure out , attached below is my sketch and trying to get my LDR to work , I have spent hours on this , almost to give up. I changed the value from 0 to 400 to 1000 still nothing, am I missing something in the code. thank you

white_led_code.ino (7.26 KB)

Please post your code.
In code tags.

Also, describe in what way exactly, it doesn't work.

A couple of things...

You are not tracking elapsed time properly.

  if (timeOut + 15700 < millis()) {      // idle state - 'breathe' the top and bottom LED to show program is looping

The only reliable way is to do subtraction from current time

  if (millis() - timeOut  >= 15700)) {      // idle state - 'breathe' the top and bottom LED to show program is looping

You do that several places in your code

This code

    uint32_t blue = (0, 0, breathe);

is not assigning an RGB value to the variable 'blue'

    uint32_t blue = strip.Color(0, 0, breathe);

Your duplicate topic has been deleted

Do not scatter the same question in multiple sections of the forum. It wastes everyone's time

blh64:
A couple of things...

You are not tracking elapsed time properly.

  if (timeOut + 15700 < millis()) {      // idle state - 'breathe' the top and bottom LED to show program is looping

The only reliable way is to do subtraction from current time

  if (millis() - timeOut  >= 15700)) {      // idle state - 'breathe' the top and bottom LED to show program is looping

You do that several places in your code

This code

    uint32_t blue = (0, 0, breathe);

is not assigning an RGB value to the variable 'blue'

    uint32_t blue = strip.Color(0, 0, breathe);

ok thanks for that, but still confused why LDR not working at all, that is not attached in any way ?

How is the LDR connected?

groundFungus:
How is the LDR connected?

have ground on LDR going to ground on Arduino, on the power side wire going to the A0 Analog in , of the Arduino, this same wire is split up , and other half going to the power source with a 270 ohm resistor.

The 270 Ohm resistor is way to low in value. I sometimes use the internal pull-up (30K to 50K). Or 10K might be reasonable. Depends on the LDR and response that you want from the LDR.

To use the internal pull-up enable it with, for example, pinMode(A0, INPUT_PULLUP).

Then write a short sketch with only the LDR connected and print the ADC values to serial monitor confirm that it works and play with the resistor value to get the response that you need.

ok thanks , I will try that way

Where, in the code, do you READ the LDR?

Do you want the LDR to measure light levels or just give a binary bright vs dark indication?

I use LDRs to detect when a model train is in position. I use a 68k (or more?) resistor in the voltage divider and use digitalRead() to sense the state of the LDR.

...R