ARDUINO TUTORIAL#1 - LED BASICS


So guys in this tutorial we will talk about the basic and easiest tutorial of all time in arduino history - THE LED CONTROL BY ARDUINO It is important for all the beginners of robotics. So let’s start

THE PARTS REQUIRED IN THIS PROJECT :-

1.ARDUINO UNO R3 .
2.LED (ANY COLOUR , HERE WHITE)
So, you have to connect the wires . the wiring diagram is given below. Connect short leg (-) to arduino gnd and led long leg (+) to digital 13 of arduino . 
So, for code you can go to Files -- Examples -- Basics -- Blink  or copy and paste the code below .

      
void setup() { // initialize digital pin LED_BUILTIN as an output.
 pinMode(LED_BUILTIN, OUTPUT);

}
 // the loop function runs over and over again forever

 void loop() {

 digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)

 delay(1000); // wait for a second

 digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW 

 delay(1000); //


CODE EXPLAINATION :-

So as you know , we first assign values and type of value (input or output) in a void named as setup .
Then in loop section , we  use digitalWrite for controlling

digitalWrite :-

digitalWrite is used to control any thing like led and motors .
it is just like switch in arduino language that controls voltage.

syntax -- digitalWrite (name of component assigned (eg ledbulitin) , HIGH or LOW ) ;

delay / delayMicroseconds:-

delay is a  statement in arduino that is used to assign delay or stop in any program .
in arduino coding, 1000 = 1 sec in delay

SYNTAX :- delay(time )

So , this was a end of this tutorial .
Please subscribe my channel ROBOMANEET on youtube and press bell icon to be updated!!
Also comment my blog and this tutorial if you like it !!!

Comments

Post a Comment