in

How to Make Led Pattern (Knight Rider) in Tamil

In this tutorial, eight LEDs are interfaced to the Arduino Uno board. This is not complicated – it is just like interfacing a single LED to the Arduino as done in tutorial 3, but eight times over. A program is then loaded to the Arduino that will turn the eight LEDs into a “Knight rider” display.

AmountPart Type
10Red (633nm) LED
1Arduino Uno (Rev3) – ICSP
1220Ω Resistor
void setup() {
  // put your setup code here, to run once:
pinMode(5,OUTPUT);
pinMode(6,OUTPUT);
pinMode(7,OUTPUT);
pinMode(8,OUTPUT);
pinMode(9,OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
int t=200;//int is intiger(numerical value)
digitalWrite(5,HIGH);
delay(t);//t=200 t is a delay time
digitalWrite(5,LOW);

digitalWrite(6,HIGH);
delay(t);//t=200 t is a delay time
digitalWrite(6,LOW);

digitalWrite(7,HIGH);
delay(t);//t=200 t is a delay time
digitalWrite(7,LOW);

digitalWrite(8,HIGH);
delay(t);//t=200 t is a delay time
digitalWrite(8,LOW);

digitalWrite(9,HIGH);
delay(t);//t=200 t is a delay time
digitalWrite(9,LOW);
//PREVIOURS PIN

digitalWrite(8,HIGH);
delay(t);//t=200 t is a delay time
digitalWrite(8,LOW);

digitalWrite(7,HIGH);
delay(t);//t=200 t is a delay time
digitalWrite(7,LOW);

digitalWrite(6,HIGH);
delay(t);//t=200 t is a delay time
digitalWrite(6,LOW);// Now back to up
}
#define ledcount 8
void setup() {
  for (int i = 2; i < 2 + ledcount; i++) {
    pinMode(i, OUTPUT);
  }
}
void loop() {
  for (int i = 0; i < ledcount; i++) {
    digitalWrite(i+2, HIGH);
    delay(200);
    digitalWrite(i+2, LOW);
    delay(200);
  }
    for (int i = ledcount-1; i > -1; i--) {
    digitalWrite(i+2, HIGH);
    delay(200);
    digitalWrite(i+2, LOW);
    delay(200);
  }
}

Written by Admin

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

GIPHY App Key not set. Please check settings

One Comment

How to Blinking a LED in Arduino in Tamil

Data Types (தரவு வகைகள்) in Arduino