Pwm

I made this function to read a value from a photoresistor, and I don’t know how to modify the intensity of a led using pwm.
`
lightreading <- hardware.pin9
lightreading.configure(ANALOG_IN);

light <- 0

function readSensor()
{
light=lightreading.read();
local value = 1 - (light / 65535.0);
server.log(format(“Lightness is:” +value));
imp.wakeup(0.001, readSensor);
}

readSensor();
`