Bukit Mertajam, Penang

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

[vc_cta h2=”” style=”outline” color=”white” add_button=”left” btn_title=”Breadboard GL-12 (C&D)” btn_color=”orange” btn_i_icon_fontawesome=”fa fa-opencart” btn_css_animation=”appear” css_animation=”appear” btn_link=”url:http%3A%2F%2Fwww.cytron.com.my%2Fp-bd-bb-0617||” btn_add_icon=”true”][/vc_cta][vc_cta h2=”” style=”outline” color=”white” add_button=”left” btn_title=”Resistor 0.25W 5% (1K)” btn_color=”orange” btn_i_icon_fontawesome=”fa fa-opencart” btn_css_animation=”appear” css_animation=”appear” btn_link=”url:http%3A%2F%2Fwww.cytron.com.my%2Fp-rs-025w-1k||” btn_add_icon=”true”][/vc_cta]
[vc_cta h2=”” style=”outline” color=”white” add_button=”left” btn_title=”LED” btn_color=”orange” btn_i_icon_fontawesome=”fa fa-opencart” btn_css_animation=”appear” css_animation=”appear” btn_link=”url:http%3A%2F%2Fwww.cytron.com.my%2Fc-114-electronic-components%2Fc-120-led-lcd%2Fc-211-led||” btn_add_icon=”true”][/vc_cta][vc_cta h2=”” style=”outline” color=”white” add_button=”left” btn_title=”Arduino Uno Rev3-Main Board” btn_color=”orange” btn_i_icon_fontawesome=”fa fa-opencart” btn_css_animation=”appear” css_animation=”appear” btn_link=”url:http%3A%2F%2FArduino%20Uno%20Rev3-Main%20Board||” btn_add_icon=”true”][/vc_cta]
[vc_cta h2=”” style=”outline” color=”white” add_button=”left” btn_title=”Female to Female Jumper Wire” btn_color=”orange” btn_i_icon_fontawesome=”fa fa-opencart” btn_css_animation=”appear” css_animation=”appear” btn_link=”url:http%3A%2F%2Fwww.cytron.com.my%2Fp-wr-jw-ff10||” btn_add_icon=”true”][/vc_cta]

Related Posts

Comments (7)

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 🙂

Hallo,

is there a copyright on the code ?

I have modfied it for 10Leds amd want to show it on my site.

Sure, go ahead, you are free to modify it and share.

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

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

Assalamualaikum and Hi..

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

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

Leave a comment

Get 7 Tips for Developing Electronic Projects
We respect your privacy.
Loading...