Arduino Basics Part 3 : Arduino 4th Lesson of Arduino Tutorial

 

This is the 4th post of Arduino tutorial. And also, this is the 3rd part of Arduino basics. Arduino basics are bit long. Alright, let’s get started.

How to include a library in Arduino?

Step 1 : Press ‘Ctrl’ + ‘Shift’ + ‘I’ or go to ‘Include Library’ in ‘Sketch’ tab then click ‘Manage Libraries’ according to this image.



Then you will get this type of GUI


Step 2 : Select the vertion and click the 'Install' button


How to include a library as zip file in Arduino?

Step 1 : Go to ‘Include Library’ in ‘Sketch’ tab then click ‘Add .ZIP library’ according to this image.


Step 2 : Then choose your zip library location and it will begin to install.



How to choose Arduino board in Arduino IDE?

Step 1 : Go to ‘Boards’ option in ‘Tools’ tab. Then select your Arduino board.

How to select Arduino board port in Arduino IDE?

Step 1 : Go to ‘Port’ option in ‘Tools’ tab. Then select your Arduino Board’s port.

Now we can have an idea about how to control Arduino IDE. Then this paragraph is for learning the structure of code and how this code going to work.

Void Loop and Void Setup

Structure of an Arduino code is made out of Void Loop and Void Setup. You can add more Voids. They are very advanced. But mainly there are two Voids.

  • Void Setup – Void Setup runs only one time. You can recognize pins of Arduino. As an example, you are using led light in 7th pin. LED is an output device. You can recognize LED light as an output device in this section. Also, you can initialize things like serial monitor in this section.
  • Void Loop – Void loop runs again and again. You can put your main code in here. IF functions are working in here. Because it needs repeat.

That is the simple introduction about Void Loop and Void Setup. Now we can learn Arduino main functions.

Main Functions of Arduino

  • ;’ – Semicolon is used for mark the end of a line in the Arduino.
  • INPUT’ – It used for recognize input devices.
  • OUTPUT’ – It used for recognize output devices.
  • #include’ – This function use for include libraries.
  • #define’ – This thing uses for renaming a pin. It means you don’t have to remember pin name always and type it. Imagine your sensor is in the 5th pin, so you define 5th pin as ‘sensor pin’ so you only have to type sensor pin the code, not 5th pin.
  • print’ – Print something in the serial monitor. As an example, show sensor data on your pc.
  • println’ – Print something with line break. Line break is like pressing enter button.
  • delay’ – Commonly used to make a delay. “delay(1000);” means make a 1 second delay. Delay function always runs in millisecond type. There are 1000 milliseconds for 1 second.
  • delaymicroseconds’ – It used in sensor works. Especially ultrasonic sensor projects. It creates microsecond delay.

So, these are the most common functions that you meet in Arduino. So, in next post we can create LED blink. I hope that you understood this Arduino Basics post. If you have any kind of question, comment below or login and send us your questions. We are here to answer you. Share this site among your friends and help them to learn Arduino and all tech knowledge.

Post a Comment

If you have any doubt, Let us know

Previous Post Next Post