Need Help with D0 Light Sensor

So I ordered this light sensor, it only has D0 no analog output. So afaik I have to connect it to D0 on the Arduino (Rx),
I in doing this I do get a reading, however I am unable to compare that reading to a value of high, low or 0 and get my code to run. as well as giving an error when updating code.(because a pin is connected to D0...)
'm trying to get the light sensor to trip a relay also connected to the Arduino then run a temp test and move some servos. I have the servos moving based on temp working, that code is sound. Its when I try to nest it into another If statement to determine if the Relay should be on or off is where it breaks down.

Now the light sensor D0 output will trigger the relay directly however it triggers in the opposite orientation to what I am after. light = relay off, no light = relay on. Only I need it in reverse. when no light, relay turns off, when light relay turns on. seems pretty simple a concept however I tried a while loop and got no response from the he relay, then tried simple nested If statements.. still not working. So i'm wondering where i'm going wrong here. is it as simple as I mixed up high low for the relay and sensor? I tried every combination to get it to trigger I just feel the comparator between the digitalinput and being high/low is not returning an accurate value.

Put a link to your sensor

And it’s likely that it’s not a serial sensor —> Don’t connect it to D0... its your serial connexion

The label just means it’s a digital output so connect it to D3 for example and read D3

If the sensor has no analogue output then it is a digital device and you can read its state with digitalRead() using any pin. You should, however, avoid using pins 0 and 1 as they are used by the serial interface.

There is also at least one error in your program. You have

 else if (DigitalValue = LOW)

I assume that you meant

 else if (DigitalValue == LOW)

Thanks for the reply, I did indeed try to query high/low on a normal pin, however i would only ever get the same response. No change when sensor changes however when i use D0 pin with digitalRead(0) i get a stable response. i also understand the sensor will trip a relay without the arduino however its opposite to what i want so the arduino is needed to swap the command. I also know its used for serial, however it only seems to impact flashing, so i just unhook that pin when its updating code, then reconnect it when done. since checking this post last i was able to get everything working, as well as throwing on an LCD to output servo position, humidity and degrees C. not the most elegant code mind you it works so far. Ideally i want to have the servos move in a fluid motion using a range from 20c to 50c moving the servos from 170 to 25 and back as it lowers. i know there is a way to do it ive seen the code before just have not looked back into it yet. wanted to get everything else working before i start to add features like that. i'm about to that point now though. Also the issue keeping me from comparing values, was that i did not have == in my if statement, i only had = that passed the value instead of comparing it... stupid mistake on my end.

i had if(x=1){}

i needed to use if(x==1){}

that got the code recognizing the change from 0 to 1, then i figured using the digitalread on 0 workaround just un hook it when flashing would get me to where i needed to be.

then i changed pin 0 to pin 12 and tried it again.... now it works probably a false positive before caused by the not having == in thereo. so yeah serial is working again lol

Yeah not a surprise... !