0% found this document useful (0 votes)
22 views

Iot Arduino

This document provides an overview of Arduino programming in 3 sentences: Arduino is an open-source hardware and software company that produces microcontroller boards for building digital devices and interactive objects that can sense and control physical devices. The Arduino programming language uses a simple wiring and coding concept to program input and output functions using sketches written in C/C++ and uploaded to the board via a USB cable, allowing projects to be programmed and reused. Arduino boards support many add-on boards called shields that allow for additional functions like sensing the environment, controlling motors, or communicating over the internet.

Uploaded by

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

Iot Arduino

This document provides an overview of Arduino programming in 3 sentences: Arduino is an open-source hardware and software company that produces microcontroller boards for building digital devices and interactive objects that can sense and control physical devices. The Arduino programming language uses a simple wiring and coding concept to program input and output functions using sketches written in C/C++ and uploaded to the board via a USB cable, allowing projects to be programmed and reused. Arduino boards support many add-on boards called shields that allow for additional functions like sensing the environment, controlling motors, or communicating over the internet.

Uploaded by

R Sabarish
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

Igloi2024.

Poge
Avduino prognamnjing
epun-ÁOunLu aâvancemunt pruto typing patfoln
which cdeperd on stmple to-tiliy equipmant and.
pmg tamning.
can ad input- such as detecting the poo
Jiqtts enent tiggerec byaButton oa toitter
an respond into a yield for exanyle,
Masage and can
Suun the engine on the LED, Send data through onirg.
’Jnstnuctionsto dhe miciocontalle ase
sec auduino pmqramming ialect nahich duperá t
oiin and hanled tbanugh the etiligaticn c
Axduino Sottoae.
’ The Arduino is a Smal0 Compcer tbat qou can
proqiam to read infomation om the cood
arOund ou and to Send Commands to the
outside wsorld
Tiny computer that you can
can conneck.
Conneck to electical
crcuit
’ Tha makes it easy to TeOd inpuls - ead
data
fromte OufRide -dànd contnl
Command to the outside, output-send
> The broin ofhia boad
CAYduino Uno) is an
ATmeqas2kchip uoheae you. stoYrr yous proq1ams tht
you auduind uhattao
Why trduino 2
Arduino ia an open Souce product
harduca hich is accesihle and Aoftuae!
CustemNS. lleaihle to
Arduino is luaible beCasuE of offeing Naiily
Outpiti analug pins. SPI. and PoM.
te

Arduno çs eauy to use, conecAed to


a compueu wia
aUSB and Communicates uuing
seçal prutocot.
->nexpensine ,auOund 5o0 upees peu boId. uth ea
authoing Soltoaue
Ardauino has qouing GnlinE.
guing Cnline cemnunty shea set c
>Arduino is CsOSS-platfsim, athich can sok on
platlems
frduino lellous Simalecleas poquang
envinment oC
(anguag
Ressto
Burton

Jact
Dt

FMCNDCOROLEN

Arduino UNo Leaming Board


Miuocentiele:
En dhe
he ATmegasa8p cu the ardino brau
Areuino boasd us meant to
Support this micD contro ler.
Diqital pins: Arduino has 14 digital pins, labeled font
to 3that can at as input (o0
'outputs
khen set as inputs, these pins Can
Gnly read 2 difeunt tats HIGt Tead votagc.They
as outpcs , thue pins Can (o) HOw. hen 5t
apply 5Y CHIGH) (o) OV CLO) apply Votage. Ihey C Ch
Phom pins:These. ase
Cotn lli0,9165adigitalpins
3). Pron
makt withar
stundyfoa"puse
modulaton' alows to make digital pins
and Nitth
Gutptfake"
eaTn more
Vaying amount of Vottage . you'l
aboutPüom later.
ete

Tx and Rx pins: digital pins Oard 1.15e T iaró for


transnit"and he Rior "yecoive'" Ayduino us0A thee
pins to Communioate oith the Cornputer. fvid usirg
theae pins, nlu you're running out of pins
1e atachd to diqital pin B: his us ustut fot an
eay debugging of the Arduino SKetches
and Rx piHs: thue pins blink wohen there are
un tonoaon being Aant toread a betoeen the
Computer and the Ardeino
’ naloq pins: the analo pins are labeled from to to f5
are mast often ecl'to ead analeg KnsoTs. thay an
read dieent aumGunt of Vottage betueen O&5v.
Adationa ly, they can alo be uud as digttal Outpd
input pins'ke the digstal pins
Povoe pins: Ihe arduuno"has 3.3V (99 5V Aeppl, Kohich is
3.3v (eVSV.
Luhl Kinu most Comporunt regui
The pinsabeolec s GNO' aue the
the qround píns.
prg12)
>Rut betn: ohen you prers that buitton, the
niit
hat is Cum entty being run in your avceino Nt
Rtae trom the beginning. You alo' hare a RESA pin
batton. Ahen yoa
tothe powe pins that acti s rect
Vottagc to that pin, it wil veut the arduino.
apply a all power is applied to the
Poua ON LED: wu be on Aince
thduino
male US8 A to male USB 6 Qbe is
DUSB Jack: Connecting a syee
you upload pog xam) tom your Comgtes to
hoo poues ybur thduino.
brduino boaud. thiscyo
pouwer jack is oheie yoa Connect q
Powsesfack: Ibe yeus arahino TFee aue
Component to pouseLup up youauoluin:
Beuivae wGus to pouse dúpetable_bautisies, aloate
bateies
Seuisal
rechasqeade
andl solas panl.
Fundamentals of Arduino pmqiamning
) srucure
-> The Structure o Arduino prnqraming containa 2part
of Arduino
) Void stupC)
yoid loop )
a) Void StupC)
void Setup () preparation furchon usdto decare \eritls
Frst pDqram that uns only one in tEe orDgam
Staternertas); | sed to set pins for señal omunicaton.
3
5) Void loop)
Void Ioop) ll6xenhun blockuoher insuchions are execaád epdy
I this is the core oê the Arduno pr4rammin
Statemert Cs)LFuncionalites involve reading ints,
irigening outputi ctc.
at

Poge

ueid stupc).
Meid sctup L)
pinnicde(pin, NAUr); pin ceniqune as Snaut.

veid deepc)
AAeid doopc) Jlaiter calinq ketup).doop) furctis,
doe its task
digitad kste Cpín, Hlau); IL séts'pid oN
delayl0o00); paues for ten thovsand mili ser
digitaLlrste Cpin. ka); lse 'pin oE
delay Caonco), l paLLs for ten theusand mili se

HunctionA

mame

buntes type kunctionnane Gauarmetr)


int kum.funcCint, ínt y)
int te0;
oid sctupi)
Statmerti

int seslt-0
kLut: Bum kuncls);

Lonstant
) TRuelFALSE -Boolan censtant trez1 and ale:0
LAelinsd.in logic Seven.
ex 12Cb=zTbe)

ldo something

pinModelI3,0UTPUD;
3) HIGqH ovo- uisd. to Ldeline pin leuels
HLGqe-1,ON.5 Ve{ts
LOp-0, OFE,0 VettA

Fauo Ceniunl Stattmncnlk


ilLAome-Voiakhlez-Value
Statunent(S); IL Evaluaid cniy'a
LLale.
Date
Poge

a).lae inputaz HlGt

ele

Statements);|LEalatd onlyi CoTys:


3)ta folinitialisation cenitim; encpression)
Dosematking LEvalugted ill cenaten
3 buremes talse
for Cint p=0:p<5;,prt+) /oeelalp tert l dat
digitatte 3 HIGH) st pn 13 O
diqtarse Cl3LD) set pin 3 OEE
2

4) uil. - uhile leop


ertctu until the capTeKim
uide paenthein deecemes lalse
uohe C`ee-Vaiahl, 2? Value)

tatemet
2
(S); |L Ealuatd i
Cenpaite
Geth na laly kalue
5)do...hile- Botfum
eualatd lop , 1ame
as WwOKS
do

Dosomeitinq:

Digital and Amalo input Octut pio) crd tis


usage

Metteds
a) pinlMoceCpio, Mao-nd to tetup) method to
ehliQue pin to behene aLneuro uTRT
pinMocepin INPUT) Ilpin át-toIPUT
pinLOde(pln, QuTPU pin Aet to uRUT
deait baing HIGittlLoo Valz digitas RacdGte
llas wsiu be equal to ínput Ain

lp'n is Aet to HLGt


ea nt I=13; Connect x' to pin 13
unt pzz; onnet puh betton to pin ±
unt vat0: yaia ole to sore the ead yeleee

pin (nope Cxi0UrpoT); llxet 'a'as OUTPUT


3
Void Jeop)
val -i qitalRead (p; llscts vals to0
digital wite (I, Va);at x'to betton vatue.
hnaleq ilo.
Mettads
a) analog lead(pin) - Reodt valaa from a ápecifid
Lanalog pán ookI Cn pín 0-5.
val=analeg Raad Gpin);Il'va'equal-tox
analog Kalue ss
blanakaq 1oite(pin scaluc)-ouity an.analag
pule wideh medulation CPm toa Rin
pins 35,6A0
example- unt rz:| anneck'xto pin 13
indpzo; l Cennack pokentiometor te analoa
int vali ( yariable fot aacdiq.

Void loop ()

ValzanalRead (p); llsta'valud to O


Val: 4

3)me
Meths

mlliscends
6)mitlis - Retuns cthe umba oe milieconds ta
alz miliso;Ikval'niebe egLal to mellis
4)math
methocs
)minlq)- caluks minimaum of Qneembons
MaleYnint Cvalo)
Ilsca'no' to
(0 (e
bmar(zy)- val=max (vat0); |l set 'vatto dageu
than O0 (o0100

> Pandom
methods
a) RndonSted (value)-Aati a valuelseed at Ktastingpoint
6) Random(mio,mar)-Alous to etun mumbe ithin
the sang sperifed by min and
mac walues
wal: sandam Coo 20);llset'va'to randem
Mumbea betuseon (00-90O.
eample int mumbe: lvaiabll tostore Tandom Value
int oc=10
Void Setup)

aandomseed Comitcs c);l st minisc) as scoc

0-200
analcg Waie Cainumbed; loutpute PaM Signal
dulay's):.

5)Saial
Metthods
Suial.beqinCrat)-Gpens hsial_port QndAct the baud
uate fo Aiial dato hansmisias

Saial begin(9600):
ldata) -piot data to the eial
BSuial-printto Cvalue; llsende tfe
Seaial pntln 'Valudo eua!
'valud: ll Aend the
monit0A

You might also like