Can a photosensitive resistor's resistance be reversed?

Hi, I have a PDR and an LED. I hooked them to the arduino with a breadboard. note that I did't add the usual 220ohm resistor. It works, just not how I predicted. As it became dark, resistance increased and vice versa. Is that reverseable?

thank you in advance!

Why do you use the map() function to reverse it ?

Using map() to reverse range

raschemmel:
Why do you use the map() function to reverse it ?

Is that really possible though?

Because the PDR is directly connected to the arduino and LED. So current comes through the digital pin, through the resistor, into the LED, and out to the ground pin...

Code right here...

void setup() {
  // put your setup code here, to run once:
Serial.begin(9600);
}

void loop() {
  // put your main code here, to run repeatedly:
digitalWrite(13, HIGH);
delay(1000);
digitalWrite(13, LOW);
delay(1000);
}

reverseAnalogInput = 1023 - analogRead(A0);?

Is that really possible though?

It would appear so.

groundFungus:

reverseAnalogInput = 1023 - analogRead(A0);

?

I don't see how that will benefit my situation? :confused:

Maybe you should post a schematic.

Did you wire it like THIS ?

No, as I said, I connected the PDR exactly like you would connect a normal 220ohm resistor to an led, directly.

Why would you do that ?
That's totally incorrect, which explains why it doesn't work.
If you are inexperienced maybe you should consider RESEARCHING your project BEFORE building it.
READ the post I linked, and then FOLLOW THE INSTRUCTIONS in Reply#3.

You want less bright LED with more ambient light? Why?

Maybe you can use a fixed current limiting resistor and wire the LDR parallel to the LED to shunt more current with more ambient light to get similar behaviour.

I don’t see how that will benefit my situation? :confused:

That was my attempt at answering this question (as I understood it)

As it became dark, resistance increased and vice versa. Is that reverseable?

raschemmel:
Why would you do that ?
That's totally incorrect, which explains why it doesn't work.
If you are inexperienced maybe you should consider RESEARCHING your project BEFORE building it.
READ the post I linked, and then FOLLOW THE INSTRUCTIONS in Reply#3.

:roll_eyes: Maybe I should have done that. I like to experiment with the arduino.

So that schematic you sent is the "proper way" to setup a PDR.

Thanks for your help!

Modify the project code using the code in Reply#3