Arduino basic:Learn every thing about arduino
Arduino Basic
Arduino is basically a micro-controller that is having the capability to control any type sensors,motors,receivers,controllers,modules,any thing.
Arduino board is having a micro-controller chip (or IC) installed in it ,which is responsible for sending and receiving different types of signals.The board is also having a small ROM and RAM in it.
so for controlling any sensor,motor, or any module ,You first need to write code in C language in the Arduino(IDE) application which can be downloaded from the web.
The Arduino board works in the Binary language that is 0 or 1,HIGH or LOW, TRUE or FALSE.So after writing the code in Arduino application you need to connect the arduino board to PC ad then press the upload button ,then you will see in the application below writing compiling ,which means that before uploading the code ,Application converts the C language written code to Machine Level language, that is Binary and then uploads it to the board.
Arduino board comes in many variants like Arduino uno,mega,leonard,mini etc
Now the most important part is the coding:-
HOW TO CODE:-
Coding an Arduino is very much easy,in fact it is the easiest part if you now the C language.
First thing: In the arduino application you will there are two thing written, Void setup and Void Loop.
Void - The
void
keyword is used only in function declarations. It indicates that the function is expected to return no information to the function from which it was called.
Setup- You need to declare the INPUT and OUTPUT of the PINs, and any code written in the void setup will run only once.
void Loop- Any code or program written in this field will run endlessly untill the power is connected to arduino.
Second : You can declare any variable name to a PIN and all the code writte i the void setup a void loop will be enclosed within { } brackets .
Let's start the coding:-
1.First you need to declare any variable name to PIN no's, this thing will be written above the void setup
like this
int LED=13;
int Buzzer=9;
Here a variable named LED is created that is connected to pin no 13 of the arduino pin
now you need to specify the in and output of the variable in void setup like this
void setup()
{
pinMode(LED,OUTPUT);
pinMode(Buzzer,OUTPUT);
}
After need to specify the working of it in the void loop like this
void loop()
{
digitalwrite(LED,HIGH);
digitalwrite(Buzzer,HIGH);
delay(2000);
digitalwrite(LED,LOW);
digitalwrite(Buzzer,LOW);
delay(2000);
}
here the led will glow for 2 seconds then it will stop for 2 Seconds ,this process repeats endlessly.
delay mease that arduino will not send any output signal or receive any input signal ie it will stop for the specied time and (1000) means 1 second,and digita write mease arduino will send a signal to the specied pin.it can be HIGH or LOW.
You can also run and check the working of this code ,(written below) just copy and paste the code to the arduino application and upload it.
//this code is written by Sameer verma
int LED=13; //connect led to the pin 13 of arduino
int Buzzer=9;
void setup()
{
pinMode(LED,OUTPUT);
pinMode(Buzzer,OUTPUT);
}
void loop()
{
digitalwrite(LED,HIGH);
digitalwrite(Buzzer,HIGH);
delay(2000);
digitalwrite(LED,LOW);
digitalwrite(Buzzer,LOW);
delay(2000);
}
see the video below:-
For any other quary please write in the comment BOX
Comments
Post a Comment