````

Arduino - Operators

An operator is a symbol that tells the compiler to perform specific mathematical or logical functions. C language is rich in built-in operators and provides the following types of operators −
  • Arithmetic Operators
  • Comparison Operators
  • Boolean Operators
  • Bitwise Operators
  • Compound Operators

Arithmetic Operators

Assume variable A holds 10 and variable B holds 20 then −
Operator name Operator simple Description Example
assignment operator = Stores the value to the right of the equal sign in the variable to the left of the equal sign. A = B
addition + Adds two operands A + B will give 30
subtraction - Subtracts second operand from the first A - B will give -10
multiplication * Multiply both operands A * B will give 200
division / Divide numerator by denominator B / A will give 2
modulo % Modulus Operator and remainder of after an integer division B % A will give 0

Arduino - Arithmetic Operators

Assume variable A holds 10 and variable B holds 20 then −
Operator name Operator simple Description Example
assignment operator = Stores the value to the right of the equal sign in the variable to the left of the equal sign. A = B
addition + Adds two operands A + B will give 30
subtraction - Subtracts second operand from the first A - B will give -10
multiplication * Multiply both operands A * B will give 200
division / Divide numerator by denominator B / A will give 2
modulo % Modulus Operator and remainder of after an integer division B % A will give 0

Arduino - Variables & Constants

Before we start explaining the variable types, a very important subject we need to make sure, you fully understand is called the variable scope.

What is Variable Scope?

Variables in C programming language, which Arduino uses, have a property called scope. A scope is a region of the program and there are three places where variables can be declared. They are −
  • Inside a function or a block, which is called local variables.
  • In the definition of function parameters, which is called formal parameters.
  • Outside of all functions, which is called global variables.

Arduino - Data Types

Data types in C refers to an extensive system used for declaring variables or functions of different types. The type of a variable determines how much space it occupies in the storage and how the bit pattern stored is interpreted.
The following points  provides all the data types that you will use during Arduino programming.
void     Boolean           char     Unsigned char     byte       int      Unsigned int    word        
 long      Unsigned long  short float              double array     String-char array     String-object

Arduino - Program Structure

In this chapter, we will study in depth, the Arduino program structure and we will learn more new terminologies used in the Arduino world. The Arduino software is open-source. The source code for the Java environment is released under the GPL and the C/C++ microcontroller libraries are under the LGPL.
Sketch − The first new terminology is the Arduino program called “sketch”.

Structure

Arduino programs can be divided in three main parts: Structure, Values (variables and constants), and Functions. In this tutorial, we will learn about the Arduino software program, step by step, and how we can write the program without any syntax or compilation error.

Arduino - Installation

After learning about the main parts of the Arduino UNO board, we are ready to learn how to set up the Arduino IDE. Once we learn this, we will be ready to upload our program on the Arduino board.
In this section, we will learn in easy steps, how to set up the Arduino IDE on our computer and prepare the board to receive the program via USB cable.
Step 1 − First you must have your Arduino board (you can choose your favorite board) and a USB cable. In case you use Arduino UNO, Arduino Duemilanove, Nano, Arduino Mega 2560, or Diecimila, you will need a standard USB cable (A plug to B plug), the kind you would connect to a USB printer as shown in the following image.
USB Cable

Introduction with ardunio

In this chapter, we will learn about the different components on the Arduino board. We will study the Arduino UNO board because it is the most popular board in the Arduino board family. In addition, it is the best board to get started with electronics and coding. Some boards look a bit different from the one given below, but most Arduinos have majority of these components in common.
Board Description

 
Powered by Blogger