Monday 22 December 2014

ARDUINO TUTORIAL FOR BEGINNERS - 2



  Hello,
            
              In the last post we have answered some of the most common Frequently asked Questions(FAQ's) about Arduino's.Hope that now you are ready with the basic setup for starting arduino,lets have a quick look at the requirements

  1. ARDUINO SOFTWARE IDE
  2. ARDUINO BOARD
  3. MOST IMP "SOME INNOVATIVE IDEAS IN YOUR MIND"
   Now that you are ready,Lets get started.

  1.  Open the Arduino IDE on the desktop 
Now lets get into the command icons that you can see on the top left corner of the desktop

      
     COMPILE :If you have done some kind of programming ever than you must have heard this word some where ,a compiler converts the HIGH LEVEL language code into the MACHINE LANGUAGE(HEX file)  which the arduino can understand

You can have a more knowledge on compiler and interpreter from the following link

     UPLOAD :This is used to transfer the code from the PC to the Arduino Board.So the upload is actually two step process in which the code is COMPILED first into the machine language and then BURNED onto the Arduino MCU(by the way arduino UNO uses the ATMEL AVR 328P-PU Micro controller )

rest of the command are self explanatory.




     2.   Now lets Start learning the Arduino "SYNTAX"

Open the "BLINK" example in Arduino the best one to start with!!!!



Lets see what the code has?????



The definition and significance of each line has been explained in the figure above

     3.  Let us list down the important Functions and Key words used in the above code:

  1. "int" :It is a type of variable 
  2. "void" : It is the type of function return,when ever we define a function in any language we need to define the type of value it gives to the output.if the function does give any value in return we name the return type as "VOID" 
  3. "setup":It is the function of Non-return type which runs for one time whenever the arduino is reset or powered.Thus it contains the intinitialization of all the things used in the code.
  4. "pinMode":This is a function which is used to define the behavior of a pin ,the pin can act as either INPUT or OUTPUT.
  5. "loop":This function is operated after the setup function has been run once and then continues to run for infinite time or until the arduino is reset or switched off. Thus it is similar to a while loop in "C"
  6. "digitalWrite":This is a function used to write a digital value (HIGH or LOW and 0 or 1) to any pin initialized in the setup as OUTPUT.    
  7. "delay()": This function is used to produce a delay in the execution of code,this is required when taking input from a sensor in order to provide settling time to the sensor and give new reading.

     4.  Practice Question:

Write a code to blink the LED connected at pin number 3 of Arduino uno and with a ON time of  700 ms and OFF time of 200 ms ?



After you have all of this please watch this video to get the things much more clear.

Tutorial 01 and 02





No comments:

Post a Comment