Knight Rider Circuit

5,751

505

21

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.

Share

    Recommendations

    • Make it Glow Contest 2018

      Make it Glow Contest 2018
    • Optics Contest

      Optics Contest
    • Plastics Contest

      Plastics Contest

    21 Discussions

    0
    None
    jakubK27

    10 months ago

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

    3 replies
    0
    None
    tdolan001jakubK27

    Reply 10 months 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
    None
    jakubK27tdolan001

    Reply 10 months 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
    None
    Pump-MD

    10 months ago

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

    1 reply
    0
    None
    morsed2

    10 months 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!)

    1 reply
    0
    None
    JohnW51

    10 months 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.

    1 reply
    0
    None
    kinte ryderJohnW51

    Reply 10 months ago

    Link Doesn't work thankx for the comment

    0
    None
    chunkysteveo

    10 months ago

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

    Steve

    1 reply
    0
    None
    gm280

    10 months 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.

    4 replies
    0
    None
    itsonlym3gm280

    Reply 10 months ago

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

    int timer = 40;

    0
    None
    gm280itsonlym3

    Reply 10 months 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
    None
    kinte rydergm280

    Reply 10 months ago

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