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:
and run the LED fade script
You can find the source for the example here.