D's Cyber Junk

Total Pageviews

Flag Counter

Followers

Sunday, March 2, 2014
Hi guys ... Today I'm gonna show you how to create simple LED protect.
You may think " I can do these projects without Arduino .... this is use less ".
But Don't forget this  "BIG THINGS HAVE SMALL BEGINNINGS"...
So lets Start ...

You will need ...
1.LED's
2.  100Ω Resisters
3.Bread Bord




4.Jumper Wires



Ok ... First You Should Setup The Circuit..

Connect GND to GND of the Led,Normally it is short pin of the LED,and connect other pin Using a Resistor to PMW pin in the Arduino(The Pins With (~) mark..



Ok now comes the Programming part ... If you're Familiar With C++ Or C programming language .This part will be very easy.... I will Add the Code bellow and Explain it one by one ..



int ledPin=10; >> In this line we are creating integer variable.And we set our led pin as the value.
void setup()     >> This is a Setup function in the Arduino.In this function we do main settings,setting up pin                                 Modes,Starting Serial connections,Attaching the servos,.... Etc .......
                              When Arduino Starting,First of all it runs the setup function one time.After that it goes to                               loop function.

pinMode(ledPin,OUTPUT) >>>> In this part we says to arduino ,How we going to use the ledPin(Or pin                                                         10).In this case we are using it as output.

void loop() >>> This is the another main function in arduino. After executing the setup function.This function                            start to running continuously.

digitalWrite(ledPin, HIGH); >>> in this line ,We set ledPin voltage to 5V.(Or high Voltage )
                                                      HIGH=5V    LOW=0V or GND

delay(1000); >>>> in this part we set a delay to programme.We have to set our delay in milliseconds.So
                                1000 milliseconds=1 Seconds .So programme go to that line ,and wait for 1second                                       before execute the next line .

digitalWrite(ledPin, LOW); in this line ,We set ledPin voltage to 0V.

So that's it ............ Now you can see The LED is blinking each one second.
It is not sooooo cool ah ?
So lets develop  the sketch little bit and see what happens.That Will be cool. See You in the next lesson .






Note:-You Can Post any comments & Ideas in the page.And i apologize about my bad English. 




Search

Popular Posts