Hello. I need your help with setting up an installation. I have a ping sensor and a group of LEDs. I want to make the LEDs light up more brightly as a person approaches the sensor. So, let's say a person is 4 meters away and the LED's start to shine. The closer a person gets, the brighter the LED's. What would the arduino code look like for that?
It's late so I don't have time to give any code examples but I think you may want to look at the PWM (Analog Output) to change the brightness of your LED's.
Step 1: Read the ping sensor value to see how close the person is. Step 2: Use that value to change the PWM signal to drive your LED's.