Making LEDS get brighter when it gets darker using LDR? Making them fade up

Im trying to make a circuit in which when there is smoke present the LEDS get brighter depending on the amount of smoke.
I had a Optical Dust Sensor before it crapped out so now i have the following to work with

potentiometers
resistors
diodes
5v relays
transistors NPN
LDRS
LED
Arduino Uno

I had it setup where the LEDS would turn on HIGH and turn of with LOW
but ive been following a few instructables and none of them seemed to work for me

Is there any way to do this without getting another Optical Dust Sensor?

I modified the code i put on here but thats what i worked with and adjusted it down to
0-20 which worked fine but was backwards for what i needed

but ive been following a few instructables and none of them seemed to work for me

That seems to be the general experience of Instructables.

You've posted over 1.5Mbyte of data, but virtually no information.

A sketch (not a screenshot) and a schematic, please.

Can you please describe:

How the LDR is wired? Please do the drawing of the schematic for us, not a photograph of half of the project.

What it does when you're running that code?

What are you talking about with something being backwards?

As long as the values you're getting back from analogRead() are consistently effected by the level of smoke, it's just a matter of converting the number you get from analogRead() into a number that'll do what you want it to when you send it to analogWrite().

If the smoke chamber with the sensor in it is transparent, or has any sort of windows in it, you'll need to do something to shield your LDR and the emitter whose light it's detecting, to ensure that the results can't be thrown off by turning out the lights (the case to achieve this is probably the source of a good portion of the expense of those dust sensors you were using).

As an aside, what on earth are you doing where smoke is present during normal operation? Based on my observations regarding the impact of smoke on electronics (from computers discarded by smokers), cigarette smoke seems to have the same effect on the lifespan of electronics as that of the smoker. Smoke is filthy, particularly if from plant material or polymers, while soot from black smoke can be conductive*, and continued exposure to smoke is probably what killed your last dust sensor. Try to avoid any complicated electronics in contact with the smoke - just have the sensor, if possible, and expect to have to periodically clean the LDR and LED illuminating it.

*"conductive carbon black" or "conductive lamp black"

The stuff im using i got of an old circuit for free so if it goes bad then that fine

Ok heres an easy one i cant figure out,

When i set it up, i get an analog A0 input of 20 when in full brightness and 0 when i stick something over the LDR.. But i want to convert those numbers so 20 doesnt mean its brighter but it means that the LED is off and when it hits 0 the LED should have full brightness

pineapple:
The stuff im using i got of an old circuit for free so if it goes bad then that fine

Ok heres an easy one i cant figure out,

When i set it up, i get an analog A0 input of 20 when in full brightness and 0 when i stick something over the LDR.. But i want to convert those numbers so 20 doesnt mean its brighter but it means that the LED is off and when it hits 0 the LED should have full brightness

Some simple arithmetic would seem to be in order then.

I did it! woot woot
So easy its hard

int LED = 9;
void setup() {

// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
}

// the loop routine runs over and over again forever:
void loop() {
// read the input on analog pin 0:

int sensorValue = analogRead(A0);
// print out the value you read:
Serial.println(sensorValue);
sensorValue = constrain(sensorValue , 0 , 80);
sensorValue = map(sensorValue, 0 , 80, 30 , 0);

analogWrite(LED, sensorValue);
delay(250); // delay in between reads for stability
}