This project shows how to fade a LED with the raspberry pi. We cover the hardware and software setup in which we connect the Grove Pi to a rotary angle sensor (a fancy name for a potentiometer). The Raspberry Pi reads the analog value and dims or fades the PWM to the LED which sets the LED’s intensity. The LED is dimmed using the potentiometer.
Setting Up The Hardware To Fade an LED with the Raspberry Pi
Simply plug the LED Module in Port D5 and the Rotary encoder in Port A0. That’s it.
Setting Up The Software to Fade an LED with the Raspberry Pi
Go to the LED fade example folder:
cd GrovePi/Projects/LED_Fade/
and run the LED fade script
python led_fade.py
You can find the source for the example here.