Knight Rider Circuit

7,077

510

22

Introduction: Knight Rider Circuit

This time its not a big project. Its just a simple circuit that uses a arduino uno, 9 Red LEDs , a Resistor, few jumpers and a breadboard to make the LEDs act like the LED panel in the michael's car.

Step 1: Things Needed+

Here the Things Needed for this project.

  1. 9 Red LEDs.
  2. A 220 Ohm Resistor.
  3. Mini Bread board.
  4. Jumpers.
  5. Arduino Uno with the cable.

Step 2: LEDs + Resistor

First of all fix the LEDs and the resistor as shown.

Step 3: Connections+

Remember to start from the pins above 1. You can use them but it may occur some problems while uploading to the board. Make sure to carefully observe the circuit diagram.

Step 4: Programing........

I am not going to explain far about the code. Simply Its programmed to Turn one led on then wait about 40 milliseconds and then trun on the other one. And It will go again and again.

Heres the code.

int pin2 = 2;
int pin3 = 3; int pin4 = 4; int pin5 = 5; int pin6 = 6; int pin7 = 7; int pin8 = 8; int pin9 = 9; int pin10 = 10; int timer = 40;

void setup(){ pinMode(pin2, OUTPUT); pinMode(pin3, OUTPUT); pinMode(pin4, OUTPUT); pinMode(pin5, OUTPUT); pinMode(pin6, OUTPUT); pinMode(pin7, OUTPUT); pinMode(pin8, OUTPUT); pinMode(pin9, OUTPUT); pinMode(pin10, OUTPUT); }

void loop() { digitalWrite(pin2, HIGH); delay(timer); digitalWrite(pin2, LOW); delay(timer);

digitalWrite(pin3, HIGH); delay(timer); digitalWrite(pin3, LOW); delay(timer);

digitalWrite(pin4, HIGH); delay(timer); digitalWrite(pin4, LOW); delay(timer);

digitalWrite(pin5, HIGH); delay(timer); digitalWrite(pin5, LOW); delay(timer);

digitalWrite(pin6, HIGH); delay(timer); digitalWrite(pin6, LOW); delay(timer);

digitalWrite(pin7, HIGH); delay(timer); digitalWrite(pin7, LOW); delay(timer); digitalWrite(pin8, HIGH); delay(timer); digitalWrite(pin8, LOW); delay(timer);

digitalWrite(pin9, HIGH); delay(timer); digitalWrite(pin9, LOW); delay(timer); digitalWrite(pin10, HIGH); delay(timer); digitalWrite(pin10, LOW); delay(timer); digitalWrite(pin10, HIGH); delay(timer); digitalWrite(pin10, LOW); delay(timer); digitalWrite(pin9, HIGH); delay(timer); digitalWrite(pin9, LOW); delay(timer); digitalWrite(pin8, HIGH); delay(timer); digitalWrite(pin8, LOW); delay(timer); digitalWrite(pin7, HIGH); delay(timer); digitalWrite(pin7, LOW); delay(timer); digitalWrite(pin6, HIGH); delay(timer); digitalWrite(pin6, LOW); delay(timer);

digitalWrite(pin5, HIGH); delay(timer); digitalWrite(pin5, LOW); delay(timer);

digitalWrite(pin4, HIGH); delay(timer); digitalWrite(pin4, LOW); delay(timer);

digitalWrite(pin3, HIGH); delay(timer); digitalWrite(pin3, LOW); delay(timer); }

Step 5: And Done!

And we done I wish you a good luck on trying this circuit. And if you like this project please make sure to vote me in the contests in instructables.

Epilog Challenge 9

Participated in the
Epilog Challenge 9

LED Contest 2017

Participated in the
LED Contest 2017

Arduino Contest 2017

Participated in the
Arduino Contest 2017

Be the First to Share

    Recommendations

    • Audio Challenge 2020

      Audio Challenge 2020
    • Maps Challenge

      Maps Challenge
    • Backyard Contest

      Backyard Contest

    22 Discussions

    0
    jakubK27
    jakubK27

    2 years ago

    Take a look at the For loop function, it would significantly reduce your code.

    0
    kinte ryder
    kinte ryder

    Reply 2 years ago

    opps thankx for the comment

    0
    tdolan001
    tdolan001

    Reply 2 years ago

    JakubK27, you are correct with one exception. You should have said

    uppercase(" significantly").

    Nice Job Kinte Ryder, the important thing is it gets the J O B done - whether in 39 bytes or 390 bytes. Tim

    0
    jakubK27
    jakubK27

    Reply 2 years ago

    It would be:

    No longer a mess of repeated strings.

    Easier to add other features, like adding more LEDs.

    Easier to change stuff.

    Probably quicker to write.

    And, I didn't mean it as an issue with the code, as you said, it works. I meant as a way to improve the programming skills of the writer / exercise for the other readers trying to learn programming. For loop is a really amazing tool, great for more advanced projects.

    0
    Pump-MD
    Pump-MD

    2 years ago

    Have you tried to sync up the music with it in arduino?

    0
    morsed2
    morsed2

    2 years ago

    Great idea, well done

    A little point that you can all try

    Instead of: int pin2 = 2; etc, etc ...

    use: const int pin2 = 2; etc, etc ...

    The 'const int' way, makes sure that the variable (in this case) pin2 is unchangeable by the program. Somewhat like a #DEFINE (but with less downfalls!)

    0
    kinte ryder
    kinte ryder

    Reply 2 years ago

    Thankx for the advice :D:D:D:D

    0
    JohnW51
    JohnW51

    2 years ago

    Very nice. Hers's a little something to get your creative juices flowing. There are 7 patterns: sequential, wigwag, center_out_back, marquee, wigwag_even-odd,
    center_out and all_wig_wag. Each pattern runs until a timer times out, then the pattern switches to the next one. After the last pattern runs, it returns to the first. I'll send you the code if you're interested. The vid is MP4. let me know if that doesn't work for you.

    0
    kinte ryder
    kinte ryder

    Reply 2 years ago

    Link Doesn't work thankx for the comment

    0
    chunkysteveo
    chunkysteveo

    2 years ago

    Loops are your friend, buddy! "I can't let you do that Michael"

    Steve

    0
    kinte ryder
    kinte ryder

    Reply 2 years ago

    :D:D:D:D:D

    0
    kode1303
    kode1303

    2 years ago

    Cool!

    0
    kinte ryder
    kinte ryder

    Reply 2 years ago

    Thankx for the feedback

    0
    gm280
    gm280

    2 years ago

    Not familiar with the syntax of the Arduino code, being I have never ever programmed one, where is "timer" described in the code? I see you calling that function both for the LED on,and LED off times, and was wondering if that was an internal function or you made a call to a subroutine you wrote. And how much time does it wait? I have programmed so many other Microprocessors and Controllers before, but not yet an Arduino.

    0
    itsonlym3
    itsonlym3

    Reply 2 years ago

    top of the code, it's a variable that's being set.

    int timer = 40;

    0
    gm280
    gm280

    Reply 2 years ago

    Oh my, I some how over looked it. Sorry, but that makes a lot more sense to me now. Thanks for pointing that out. Also a great idea so if you want to lengthen the time delay, you do it in one place.

    0
    kinte ryder
    kinte ryder

    Reply 2 years ago

    Its looked like I was late to help but anyway thankx for commenting