Re: ldr
Posted: Tue May 11, 2010 2:15 pm
Use the LDR and a fixed resistor, R, to form a potential divider circuit between the microcontroller positive supply voltage (Vcc) and 0V. The value of the fixed resistor will depend on the characteristics of the LDR
Connect the common point of the resistor and LDR to an analogue input.
The measured voltage will be:
Vcc x Rldr/(R + Rldr) if the LDR is connected to 0V
or
Vcc x R/(R + Rldr) if the LDR is connected to Vcc
Connect the common point of the resistor and LDR to an analogue input.
The measured voltage will be:
Vcc x Rldr/(R + Rldr) if the LDR is connected to 0V
or
Vcc x R/(R + Rldr) if the LDR is connected to Vcc