KNOWX INNOVATION PVT LTD
ARDUINO
MICROCONTROLLER
INTRODUCTION
Arduino is a open-source platform.
Easy-to-use hardware and software.
Arduino provides a standard form factor that breaks the
functions of the micro-controller into a more accessible
package.
It consists of a circuit board, which can be programmed with a
ready-made software called Arduino IDE.
Features Of Arduino
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.
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.
Additionally, the Arduino IDE uses a simplified version of C++,
making it easier to learn to program.
Finally, Arduino provides a standard form factor that breaks the
Boards of Arduino
ARDUINO UNO ARDUINO MEGA ARDUINO NANO
NODEMCU
ARDUINO YUN ARDUINO DUE
ARDUINO UNO
FEATURES OF ARDUINO UNO
Microcontroller - ATmega328
Operating Voltage - 5V
Input Voltage (recommended) - 7-12V
Input Voltage (limits) - 6-20V
Digital I/O Pins - 14 (of which 6 provide PWM output)
Analog Input Pins - 6
DC Current per I/O Pin - 40 mA
DC Current for 3.3V Pin - 50 mA
Flash Memory - 32 KB (ATmega328) of which 0.5 KB used by bootloader
SRAM - 2 KB (ATmega328)
EEPROM - 1 KB (ATmega328)
Clock Speed -16 MHz
ARDUINO SOFTWARE
OPEN YOUR FIRST PROJECT
1. Once the software starts, you have two options −
Create a new project.
Open an existing project example.
Step – 1: To create a new project, select File → New.
Step – 2: To open an existing project example, select File →
Example → Basics → Blink
Step 3 −
Select your Arduino board.
Go to Tools →
Board and select
your board
Step-4 − Select your serial port.
Tools
Serial Port
Step-5
Upload the program to your board.
A − Used to check if there is any compilation error.
B − Used to upload a program to the Arduino board.
C − Shortcut used to create a new sketch.
D − Used to directly open one of the example sketch.
E − Used to save your sketch.
F − Serial monitor used to receive serial data from the board and send the serial data
to the board.
PROGRAMMING
STRUCTURE
Arduino programs can be divided
in three main parts: Structure,
Values (variables and constants),
and Functions.
Software structure consist of two
main functions −
Setup( ) function
Loop( ) function
Setup( ) function
setup() function is called when a sketch starts.
It is used to initialize the variables, pin modes, start using libraries,
etc.
The setup function will only run once, after each power up or reset of
the Arduino board.
Loop( ) function
The loop() function does precisely what its name suggests, and
loops consecutively, allowing your program to change and respond
pinMode()
Configures the specified pin to behave either as an input or an output
It is possible to enable the internal pullup resistors with the mode
INPUT_PULLUP. Additionally, the INPUT mode explicitly disables
the internal pullups.
◦ Syntax
pinMode(pin, mode)
◦ Parameters
pin: pin number
mode: INPUT, OUTPUT, or INPUT_PULLUP.
digitalWrite()
Write a HIGH or a LOW value to a digital pin.
If the pin has been configured as an OUTPUT with pinMode(), its voltage
will be set to the corresponding value: 5V for HIGH, 0V (ground)
for LOW.
If the pin is configured as an INPUT, digitalWrite() will enable (HIGH) or
disable (LOW) the internal pullup on the input pin. It is recommended to
set the pinMode() to INPUT_PULLUP to enable the internal pull-up
resistor.
◦ Syntax
digitalWrite(pin, value)
◦ Parameters
pin: the pin number
value: HIGH or LOW
digitalRead()
Description
◦ Reads the value from a specified digital pin,
either HIGH or LOW.
Syntax
◦ digitalRead(pin)
Parameters
◦ pin: the number of the digital pin you want to read
Returns
◦ HIGH or LOW
analogRead()
Reads the value from the specified analog pin
10-bit analog to digital converter.
Syntax
◦ analogRead(pin)
Parameters
◦ pin: the number of the analog input pin to read from (0 to 5 on
most boards, 0 to 7 on the Mini and Nano, 0 to 15 on the Mega)
Returns
◦ int(0 to 1023)
Arduino - Blinking LED
void setup()
{
pinMode(2, OUTPUT);
}
void loop()
{
digitalWrite(2,HIGH);
delay(1000);
digitalWrite(2, LOW);
delay(1000);
}
LAB SESSION:
LED Blink
ALL LED Blink
Reference blink
Even Odd LED Blink
Multiple LED blink
LED right shift
LED left shift
Right and Left LED shift
THANK YOU