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.
- After download, extract the file and save it at your arduino-0022\libraries.
- 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(pin, value)
~ 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
BUY
7 thoughts on “PROJECT 4 – KNIGHT RIDER LIGHT BAR”
Hello, please;
Is possible send my email SoftPWM.Zip
Because The requested URL /files/Arduino-Library-SoftPWM.zip was not found on this server. That’s all we know.
Thanks
Assalamualaikum and Hi..
I also having the same problem as Frank has. can anyone respond for our problem.
thanks.
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
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!!!
Sure, go ahead, you are free to modify it and share.
Hallo,
is there a copyright on the code ?
I have modfied it for 10Leds amd want to show it on my site.
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 🙂