Easier Approach to Electronic Projects

LED Chaser using Arduino


This is a LED Chaser, with the simplest code. Here you vary the speed of chasing LEDs by potentiometer which is as analog input to arduino.You can have different LED glowing arrangements, like Knight Rider is kinda famous, you can make it by simply putting the same loop but with descending outputs ūüėČ try it.

The potentiometer has three pins, the centre one is connected to the analog input of arduino and rest of two pins are GND and Vcc

In the picture, the blue lead is going to 5v of Arduino, red lead is connected to GND and Orange lead is connected to analog input of arduino, (Here A0).Here I have used the potentiometer of 100k, However it does not matter, because in programming we set the value ranging from 0-255

 

Connections with Bread board:

Arduino has two GND pins one is along with power pins and other one is along with digital pins. Both of the GND pins are common, so you may connect the GND pin of potentiometer to either one ūüėČ
The programming code is actually not the proper one, It should be done with bunch of nested for loops which is quite complicated, this is what you are here for, things in easier way, rookieelectronics.com ūüėČ

I found some on google and they had so many for loops and stuff. But this is a ROOKIE code :p just to Turn On and Off LEDs in loop in a sequence.¬†You can select any outputs right now i have selected 8-12, you can use all output pins from 1-13 and have 13 LEDs and have a longer LED chaser ūüėČ

CODE:
int delayTime = 0;
void setup()
{
  pinMode(8, OUTPUT);        
  pinMode(9, OUTPUT);
  pinMode(10, OUTPUT);
  pinMode(11, OUTPUT);
  pinMode(12, OUTPUT);
}
void loop()        //this means Perform functions again and again
{
  delayTime = analogRead(0);                   //0 means Analog Input A0
  digitalWrite(8, HIGH);    delay(delayTime);
  digitalWrite(8, LOW);    delay(delayTime);
  digitalWrite(9, HIGH);    delay(delayTime);
  digitalWrite(9, LOW);    delay(delayTime);
  digitalWrite(10, HIGH);  delay(delayTime);
  digitalWrite(10, LOW);  delay(delayTime);
  digitalWrite(11, HIGH);  delay(delayTime);
  digitalWrite(11, LOW);  delay(delayTime);
  digitalWrite(12, HIGH);  delay(delayTime);
  digitalWrite(12, LOW);  delay(delayTime);  
}

Read more:
4
LFR using BC108 Transistors

This is a Line Following Robot and is simplest possible electronic circuit to make your first robot. The key to...

FEATURE SLIDER
LFR Using Just 555 Timers

This is Simple and cheap approach to Line Following Robot, This do not have any micro controller but just a simple...

Fading LED (2)
Fading LED with 555 Timer

Phewwww Finally it worked!! "Successs!!!" (Dexter's style) I used arduino and it was too easy to just control the Brightness...

Close