Dimming Lightbulbs using a Light Sensor

Hello all.

I'm working on building an installation where there are 5 lightbulbs that will light up when people come near them and fade or dim when people move away from them.

I'm very new to arduino but I have made a project in the past where I had 3 DC motors speed up and slow down according to a fade code.

I was thinking about using that same code for the lightbulbs but add something for the sensor.

But:
A. I'm not even sure if this will work.
B. I don't know how to add the sensor variable.

Would really really appreciate the help!

Sh.

Hi!

i would try to use the PWM pins:

then u could concentrate in the loop() function on

  1. reading the distance sensor and
  2. computing+setting the correct PWM/dim/fade value...

Bye