Thursday, November 13, 2014

My First Program in arduino

Connect arduino. Aduino power led will light up.

Open the arduino and verify the port.(Tools-->port-->SELECT PORT)

Then Go to File -> Examples -> Basics -> Blink


After that you can see an a new program.


We will learn some features in arduino language in this section.
               Notation:- 
  •             //     anything type behind the // mark is not compiled. We say they are comment
  •           /*  */  Anything between  /* and */ is also comment.

                                    
What is void setup?
void setup() is a function.
         Mainly this function is use to setup pins.
           Means in arduino we must specify the pin status.(weather input or output)
          To setup the pin status we call another function called 
                                      pinMode(x,y)
         x=pin no
         y=status

pin no can be found by looking at the board.


In the board they name the pin in white colour.(See Arduino pin description page)

What is loop() function

              This is the section where our tasks must put in. and this code segment is run as a loop.(infinte loop)

digitalWrite(x,y)

x=pin no
y=value(in digital HIGH or LOW) High means it out +5v Low means it out 0V.

 once you set the value to HIGH or LOW it remain same as untill you edit the pin values again.

delay(x) is a function which can wait for x miliseconds. 

In this code you can check by putting any value to delay() function.

Now click on the right mark button in the top to compile.

When compiling you can see following message


 If your code does not make any compilation errors this message will come up.


Now click this button to upload your code in to the arduino board.

When code is uploading to your board Rx and Tx indicators are light up.
After that you can see one light in board is blinking.


No comments:

Post a Comment