November 16, 2016

Fading a LED using Arduino UNO



FADING A LED USING ARDUINO UNO

INTRODUCTION

Arduino is a micro-controller which can be programmed to do certain operations like lighting led, controlling servo, etc. We’ll use Arduino UNO or any other clone for performing this Fading experiment. Fading a led in simple definition means turning the led ON and slowly turning it OFF within a finite (large) time interval. The time interval must be more than one second in order to experience the Fading of led.



MATERIALS REQUIRED

  • Arduino UNO or any other clone and USB cable

  • 5mm LED

  • 20 K ohm resistor

  • Breadboard

  • Jumpers

PROCEDURE

  • Connect any analog pin (usually marked by ‘~’ in front of the pin number) of Arduino to longer leg of led via a resistor.

  • Now connect the shorter leg of led to ground pin on Arduino.

  • The circuit is complete, upload the code and you can verify the output.

  • The USB cable serves both as a medium to upload code as well as 5V power source.


CODE

The code for Fading led is available in basics library in Arduino IDE.

You can select the analog pin (~3, ~5, ~6, ~9, ~10 or ~11) you want to use. Also you can vary the delay time which will change your fade output.

No comments:

Post a Comment