PROJECT 4 – KNIGHT RIDER LIGHT BAR

PROJECT 4

KNIGHT RIDER LIGHT BAR

Back to Project 3                                                                                                       Go to Project 5

Ever watch knight rider movie? The car (KITT) have a very cool light bar in front and where most people like to have one of it. Here, we are going to make one of it using Arduino Duemilanove interfacing with 8 LEDs. Enjoy..

———————————————————————————————————————————————————-

COMPONENT NEEDED

———————————————————————————————————————————————————-

BREADBOARD
 JUMPER WIRE
LEDs
1K RESISTOR

———————————————————————————————————————————————————-

CONNECTION

———————————————————————————————————————————————————–
There are total of 8 LEDs using which the anode are all connected to digital port(2,3,4,5,6,7,8,9) which ORANGE wires. On other hand, the cathode of LEDs are connected to 1K resistor then go to ground (GND).

———————————————————————————————————————————————————-

ADDITIONAL INFORMATION

———————————————————————————————————————————————————-
For this project, user are require to download a new library file for Arduino here. This is a SoftPWM library which use to generate simple PWM using timer 2.

To insert the file into Arduino library, please follow the following steps.

  1. After download, extract the file and save it at your arduino-0022\libraries.
  2. Restart your arduino.exe (if you are currently using it).

———————————————————————————————————————————————————-

CODE OVERVIEW

———————————————————————————————————————————————————-

#include <SoftPWM.h>
Include the header file always at the beginning of the each program.

Int leds[8] = {2,3,4,5,6,7,8,9};
Define the LEDs pin using on each digital port.

SoftPWMBegin();
Initializes the library – sets up the timer and other tasks.

SoftPWMSet (leds[i], 0);
SoftPWMSet(pinvalue)
pinis the output pin.
~ Valueis a value between 0 and 255 (inclusive).

SoftPWMSetFadeTime (ALL, 30, 200);
SoftPWMSetFadeTime(pin,fadeUpTime,fadeDownTime)
pin is the output pin.
Fadeuptime is the time in milliseconds that it will take the channel to fade from 0 to 255.
~ Range: 0 to 4000
fadedowntimeis the time in milliseconds that it will take the channel to fade from 255 to 0.
~ Range: 0 to 4000

SoftPWMSet (leds[i+1], 255);
Set the desire pin to HIGH(1) and LOW(0)
E.g: if i = 0, (leds[ i + 1] = 1, 255) (pin-3, ON)
(leds [6 – i] = 6, 255) (pin-6, ON)
(leds [i] , 0) (pin-0 , OFF)
(leds [7-i], 0) (pin-7, OFF)

Back to Project 3                                                                                                       Go to Project 5

———————————————————————————————————————————————————-

ATTACHMENT

1. P4 User Manual.pdf
2. Project_4_code.zip

Buy

, , ,

Related Post

Getting Started with 3A Motor Driver Shield and Arduino Uno

How to Upload Arduino Codes to Arduino Yun Through WiFi

Introducing 30A Dual Channel DC Motor Driver with Smart Features – SmartDriveDuo-30

How to Make your Line Following Robot Faster?

6 thoughts on “PROJECT 4 – KNIGHT RIDER LIGHT BAR

  1. i’ve got error when i try this project, my board is using arduino duimeilanove, arduino software version 1.0.1

    here’s the error message : arduino-1.0.1\libraries\SoftPWM\SoftPWM.cpp:199: error: ‘pinMode’ was not declared in this scope

    i hope i can resolve the problem, i’ve try but still error, so i need help thank u 🙂

  2. Hi!!! Great tutorial!!! I’d like to know how can i modify for make the classic larson scanner effect (from edge to edge and again), can you help me? thanks!!!

  3. Hi!
    I like this project, but I’ve got an arror at line with >>>>> for (i = 0; i < 3; i++)

    It shows expected unqualified-id before 'for'.

    Can I get help, please?

    Thanks in advance

  4. Assalamualaikum and Hi..

    I also having the same problem as Frank has. can anyone respond for our problem.
    thanks.

Leave a Reply

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