led blinking #1
hey guys today we are going to know about the programming in arduino how it goes and how can we connect it and all of this things so let's start with the led sure we all know about the led and what is it but i will put a pic of it here.
okay as shown here we gotta two legs here the long one is anode and the short one is cathode,and here another pic with the explanation.
as we see the the anode has to get +ve energy while the cathode has to get -ve energy and the another pic is the schematic of the led we won't use this now.
and here we are done with led explanation,so let's go to the another part (programming !!)
.
.
okay in the previous part we knew about the arduino UI so let's use it now.
here is the led's code so let's explain it...i will do this by the numbers in the pic,but before we do this we have to know something that the highlighted words (void setup and void loop)means that the void setup we do the action i ordered to do just one time forever but the void loop we repeat the action i told it to do many times
1-here we are saying to arduino that i want the electricity to come out from pin number 3 as we say (int) we have so many words than int but we wont use it today and that led i wrote means that i told my arduino that this pin (pin 3) i will name it with led to be easier for me to determine every pin.
2-here i wrote pinMode that refers that the mode of the led (pin 3 ) will be output and that means that the arduino will get some electricity out to that pin.
3-and here in the loop i said digitalWrite that means that the electricity will get out is digital if it is 1 or 0 that means on or off and then we said led,HIGH that means that i will make the led on i will let the arduino get some electricity out for the led
4-and here with delay that means after the led blinks the arduino will stop for 1000 millisecond (1 second) then it works again
5-here is the typically the same of number 3 but the diff. in this that i said led,LOW that the led will be off there is no electricity come out
6-and here the same of 4 to let the arduino stop working till the second and works again and this will let the led to take it's time in blinking
and here is the connections and the led will hopefully blinks but let the connections for another time.
see you soon..
Comments
Post a Comment