Introduction: Knight Rider Circuit

Picture of 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+

Picture of 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

Picture of LEDs + Resistor

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

Step 3: Connections+

Picture of 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........

Picture of 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!

Picture of 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.

Comments

jakubK27 (author)2018-01-01

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

kinte ryder (author)jakubK272018-01-16

opps thankx for the comment

tdolan001 (author)jakubK272018-01-02

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

jakubK27 (author)tdolan0012018-01-05

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.

Pump-MD (author)2018-01-01

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

kinte ryder (author)Pump-MD2018-01-16

nope

morsed2 (author)2018-01-01

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

kinte ryder (author)morsed22018-01-16

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

JohnW51 (author)2018-01-02

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.

kinte ryder (author)JohnW512018-01-16

Link Doesn't work thankx for the comment

chunkysteveo (author)2018-01-04

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

Steve

kinte ryder (author)chunkysteveo2018-01-16

:D:D:D:D:D

aduifhuhfuhs (author)2018-01-12

good job

kode1303 (author)2017-12-28

Cool!

kinte ryder (author)kode13032017-12-28

Thankx for the feedback

gm280 (author)2017-12-28

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.

itsonlym3 (author)gm2802017-12-28

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

int timer = 40;

gm280 (author)itsonlym32017-12-28

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.

kinte ryder (author)gm2802017-12-28

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

kinte ryder (author)itsonlym32017-12-28

Thankx for helping "gm280"

kinte ryder (author)gm2802017-12-28

Top of the void setup(){.Its an internal function.40 Milliseconds. I wish you a good luck on programming arduino.

About This Instructable

4,566views

447favorites

License:

More by kinte ryder:Arduino Bluetooth Controlled RC CarKnight Rider CircuitWrapped Balloon Lamp
Add instructable to: