Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 14
Arduino is a prototype platform (open-source) based on an
easy-to-use hardware and software. It consists of a circuit
board, which can be programed (referred to as a microcontroller) and a ready-made software called Arduino IDE (Integrated Development Environment), which is used to write and upload the computer code to the physical board. The key features are −
Arduino boards are able to read analog or digital input signals from different sensors and turn it into an output such as activating a motor, turning LED on/off, connect to the cloud and many other actions.
You can control your board functions by sending a set of instructions to
the microcontroller on the board via Arduino IDE (referred to as uploading software).
Unlike most previous programmable circuit boards, Arduino does not
need an extra piece of hardware in order to load a new code onto the board. You can simply use a USB cable. Board Types
Various kinds of Arduino boards are available depending on different
microcontrollers used. However, all Arduino boards have one thing in common: they are programed through the Arduino IDE. The differences are based on the number of inputs and outputs (the number of sensors, LEDs, and buttons you can use on a single board), speed, operating voltage, form factor etc. Some boards are designed to be embedded and have no programming interface (hardware), which you would need to buy separately. Some can run directly from a 3.7V battery, others need at least 5V. 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. Structure: Arduino programs can be divided in three main parts: Structure, Values (variables and constants), and Functions. In this lesson, we will learn about the Arduino software program, step by step and how we can write the program without any syntax or compilation error. Software structure consist of two main functions: Setup( ) function Loop( ) function Main Functions • setup(){} • loop(){} • The setup() function is called • After creating a setup() function, when a sketch starts. Use it to which initializes and sets the initialize the variables, pin initial values, the loop() function modes, start using libraries, etc. does precisely what its name The setup function will only run suggests, and loops once, after each power up or consecutively, allowing your reset of the Arduino board. program to change and respond. Use it to actively control the Arduino board. 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 table in the next slide provides all the data types that you will use during Arduino programming. Arduino- Data Types void Boolean char Unsigned byte int Unsigned word char int
long Unsigned short float double array String- String-
long char array object Variable Scope • Before we start explaining the variable types, a very important subject we need to make sure, you fully understand what 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.