Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
55 views

Arduino Tutorials

Arduino tutorials

Uploaded by

Kiran Deshmukh
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
55 views

Arduino Tutorials

Arduino tutorials

Uploaded by

Kiran Deshmukh
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

eo

ARDUINO
tutorialspoint

www.tutorialspoint.com
ttps://www.facebook.com/tutorialspointindia https://twitter.com/tutorialspoint
Arcluino

Aboutfre Tutoial based on an easy-to-use hardware


and
platform (open-source) (referred to as
Arduinois a prototype a circuit board, which can be programed
software. It consists of ready-made software called Arduino IDE (Integrated
a
a microcontroller) and which is used to write and upload the computer
code to the
DevelopmentEnvironment),
physical board.
the micro-controller
provides a standard form factor that breaks the functions of
Arduino
into a more accessible package.

Audience
or hobbyists. With Arduino, one can get
This tutorial is intended for enthusiastic students very quickly and can start building
to know the basics of micro-controllersand sensors
prototype with very little investment.

Before you start proceedingwith this tutorial, we assume that you are already familiar
with the basics of C and C++. If you are not well aware of these concepts, then we will
suggest you go through our short tutorials on C and C++. A basic understanding of
microcontrollersand electronics is also expected.

Copyright & Disclaimer


@ Copyright 2016 by Tutorials Point (I) Pvt. Ltd.
All the content and graphics published in this e-book are the property of Tutorials Point (I)
Pvt. Ltd. The user of this e-book is prohibitedto reuse, retain, copy, distribute or republish
any contents or a part of contents of this e-book in any manner without written consent
of the publisher.
We strive to update the contents of our website and tutorials as timely and as precisely as
possible, however, the contents may contain inaccuracies or errors. Tutorials Point (I) Pvt.
Ltd. provides no guarantee regarding the accuracy, timeliness or completeness of our
website or its contents including this tutorial. If you discover any errors on our website or
in this tutorial, please notify us at contact@tutorialspoint.com

tutorialspoint
Arduino

Tableof
About the Tutorial ...........
Audience...
Prerequisites.........................
Copyright & Disclaimer......
Table of Contents ..... . ii

ARDUINO- BASICS
L. Arduino —Overview
v.B6å7d Types ........

rduino —Board Description

uino —Installation

rduino —Program Structure 17

duino —Data Types 19


void...................... .19
Boolean........................................ 19
Char .................. ................... 20
unsigned char .................... ............. .21
byte..... .21
int 21
Unsigned int ....... ... 21
Word............. . ... ... .. .. 21
Long.................. . ..... 22
...... . .................. 22
unsigned long .... .. .....
.. 22
short ..........
float ..
............. 22
.23

.w —uino —Variables & Constants


24
.................................24
What is Variable Scope? .........

26
7k-—AfÖuino—Operators
26
Arithmetic Operators..........
• ..... ........ 27
Comparison Operators .....................„.
Boolean Operators ..........................„
.................. 29
.......... 30
Bitwise Operators........................„••••
• ....... 31
Compound Operators.............

duino —Control Statements


33
34
if'tatement
If ...else statement 35
if,.else if ...else statement. ........ 37
Switch Case Statement ..... 39
Conditional Operator ? : 41
Rules of Conditional Operator
41

rduino —Loops 42

ij
tutorialspoint
Arduino

... 42
while loop ....
do...while loop
for loop ....
Nested Loop
. 45
Infinite loop

Arduino - Functions
48
Function Declaration ..

. Arduino —Strings
51
String Character Arrays..............
• 52
Manipulating String
Functions to Manipulate String Arrays ......
Array Bounds ..................

59
Arduino —String Object
59
What is an Object? .....
When to Use a String Object ...........
62
13. Arduino —Time
.62
delay() function ........................
63
delayMicroseconds() function ........
.63
millis() function..................
... ... 64
micros() function
66
4. Arduino —Arrays
Declaring Arrays .........
Examples Using Arrays ..............
70
Arduino —Passing Arrays to Functions ... ..... •
... 73
Multidimensional Arrays ..........

78
ARDUINO - FUNCTION LIBRARIES
79
5. Arduino —I/O Functions
.. ..... ..... ..... .... 79
Pins Configured as INPUT ........
.. 79
Pull-up Resistors
• •• .. ............ 80
Pins Configured as OUTPUT...........................„
. 80
pinMode() Function
• ........... 81
digitalWrite() Function
analogRead( ) function
84
16 duino —Advanced I/O Function ... ........... 84

analogReference() Function
86
Functions
17. Arduino —Character .87
Examples.....
93
Arduino —Math Library . ...93
Library Macros............„•••••••••••• .... ............... 95
Library Functions . 99
Example
101
Functions
19. rduino —Trigonometric

tutorialspoint
Arduino

Af6UIN0 —ADVANCED 102


20. Arduino —Due & Zero 103
Arduino Zero . 104

Arduino —Pulse Width Modulation ..............106


Basic Principle of PWM .106
analogWrite() Function............... 107

22. Arduino —Random Numbers .. 109


randomSeed (seed) .. 109
random( ) 109
Bits ...... .......... 110
Bytes . ..... ................ 110

23, Arduino —Interrupts 112


Types Of .. .. ........... ...... 113

24. Arduino —Communication 115


Parallel Communication ... .... ......................115
Serial Communication Modules ................... . 115
Typesof Serial Communications ............ 116
Arduino UART .......................... . 117

rduino —Inter Integrated Circuit .... 119


Board 12C Pins............... . 119
Arduino 12C.................. .. . 119
Master Transmitter / Slave Receiver ............... . ... . .........l........
120
Master Receiver / Slave Transmitter .................. .. . 121

26. Arduino —Serial Peripheral Interface .. 123


Board SPI Pins ............ . .. 123
SPI as MASTER ........................ .. . .........................124
SPI as SLAVE.......... . 125

ARDUINO- PROJECTS 127

27. Arduino —Blinking LED 128

28. Arduino - Fading LED 132

29. Arduino —Reading Analog Voltage 137

30. Arduino —LED Bar Graph 141

31. Arduino —Keyboard Logout 145

32. Arduino —Keyboard Message 151

33. Arduino —Mouse Button Control

34. Arduino —Keyboard Serial 158

iv
tutorialspoinc
Arduino

ARDUINO —SENSORS
11
—Humidity Sensor

•-3<Arduino —Temperature Sensor

37. Arduino —Water Detector / Sensor

\--3CArduino —PIR Sensor

NKArduino —Ultrasonic Sensor

40. Arduino —Connecting Switch 13

ARDUINO —MOTOR CONTROL

41. Arduino - DC Motor


Motor Speed Control ........... 190
Spin Direction Control Id2

42. Arduino Servo Motor 196

Arduino —Stepper Motor 201

ARDUINO AND SOUND

44. Arduino —Tone Library


206
. Arduino —Wireless Communication
212
46. Arduino —Network Communication
217

tutorialspoint

You might also like