0 ratings0% found this document useful (0 votes) 2K views48 pagesArduino
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here.
Available Formats
Download as PDF or read online on Scribd
=
Programming)pdilend ae One ?
What is Arduino ?
atieal ag gapsegsan ofed Gbeemed Gym OHGined age xaga ode
SIGOMODH 88S Guemreac m Sled smemgSs S60 chad Alana meso, oB
a0 Baed ember mds PIC IC 08Geq! onluieOie i atnsed még.
atieal om PIC B8enh eailadie com exakeS? 085 ac& sthe sladnes Sod
tient BE) Od O ccadas oy eremoocd ach amd bad Boose eB® oodes
em Segeia emnam mBdES.
Ardiuno SGoSa etadess Stew ele! mb gems Bat ag sat Oecd
Gabe Go, 8 QOS Had eBGteOs em esgeds Gas ofedq Btn memes.
feed PICIC Bical eakdetio opm ane) med 98K
Siimiob BGai god soe Canes MeO cdo €0c exGa.
COS wes BOD
Arduino is an open-source electronics pratotyping platform based on flexible, ensy-to use
bardware-and software, [tis intended for artists, designers, hobbyists, and anyone interested in creating
interactive objects or environments.
ebieal s6odast Gs mencied meule ?
G09 E6e0 eden mS HOD BED Gbsray meme. obeded Sal ey agen BOG O00
ec8bE Coxe Bing eS ems BO eusin exis MEoees emcsad miaad disGao
ScS5@ one Giemoe ermB acc, a6) gad,
LED cfd come
Scoe8t BOGoan exoBo.
28S mem GOS mrnBe
CSN0O ra cco
Blase mdsiss cone eas, otha aad oF,
What Can You Do With an Arduino?
There is a lot you can do with an Arduino. An Arduino can basically do anything by interfacing
Sensors with a computer. This would allow you to take any sensor and have any action applied with
the readings. Such as,
LED Circuits
Remote contralled cars
Motor contro! circuits Sm
Temperature sensors
Home automation systemsbien] sises ge aed One?
BOD © entteal ofodet e600 GEo meio, C0 Gaed am aden ebdsai
Cas] ” Arduino UNO" OB80o co saxmnBO8, BO C560 Game meni ey BO Saga
Ece ees ace con de,
Sue ubsisies “ Arduino UNO” USB eSed odens.
G0 Atmega 168/328p oSGemt emeteGiec exes! “Arduino UNO" Séceat ober,
exes Ege magna. 080 thancend mde syiges camo cada eae OES,
BOGE SEEe SekoeBOO ae ~ Arduino UNO” USB emncedie eSoded eae
ekeSs Gbed Coxe oe one
+ Processor: 16 Mhz ATmegag2e / Atmegaté6
« Flash memory: 32 KB
+ Ram: 2kb
» Number of analog inputs: 6
+ Number of digital I/O: 14 (6 Pwm)
USB
to computer Oo
7 to 12V a28234
DC Input eee 0
GBR exh CD oxBed Arduino UNO” USB. Sod eOe . Tools em Gen 88s} Open m@ BO ersten
eS See Cetedd GraisOn moncad mes ec ¢B Deen,
eT
r a Auto Raumati
Maia archive Sketch,
ketch junora| FicEncadno @ Reload
Dold eeeap is «| Sel Monter Chasm
Pane voue
1
voit Loop) (| _ BunBoctloader,
/ wae Pou mal Code Kaee, ee zu eepeaeediy:
3
i
Tools 88g© @Oes Board ; “Arduino Uno” See EtieS oS Arduino Uno USB PCB cbeda
SES ape Drivers eSanme OGat SERED cio a& God es Pon; « COMI” ec
are® © oc GOs seed, (Quast SGommact § o88 Com! eos eSadde orf 0 oumein )
egige® ( Sketch ) Arduino Uno PCB BOS Qed eng G60
|, 8886 Arduino 1.6.4 e93 Ardiuno 1.6.5 Ga¢avonw Open meetin.
2 Go) som eeiels egigdc 28 ede edaien,
Etienne
}) the Loup Cunceion eune see gad rei sgetn teceres
rd Angpl) |
POD suas GOED sous Booval om Desktop G LED ON OFF age: save mdein
GS Sxemooned ec Sketch BOAO MeO cord Compile / veryfy send Ctrl +R B0ac
Bdeien,
Eo 28 Sketch o GERSEOS ono epdeOen exmded Gogmomad ome emdsd
Done compiling oe ernisa eae Desktop 8 LED ON OFF eGe Folder ae gem ee
Gg Sketch o eis wet.UD COMETH pee
G4 USB PCB BEc® ( Arduino Uno efede ) stems eon HBG mdsin. o88
Sacowoed e:6 Upload een semal Oma sex Chl LU Boma oSaee eee sketch @
Arduino Uno Stoced a8 IC cenme ea acBO naSests.
StKCED Upload fed a8 e@eork Done uploding eee emoned onBel entsos,
GS S00 quedo mmded olodeds ene PCB 9O%60 DC Savas exememet
S22 emEsc) ON a) OFF B80 SOains,
SS MNGeO GUI Sketch ow! oloes Sobeaes Compile BCG oa SOx6RS8 econ
Arduino Uno 86020 upload 8606 me exc.
7|@|
fs
ae
Bae
Be
8
(aces i |
=| 7 ‘s LED
if
2) te
ie
2] ik
is
|
Ardiuno Uno 686560 Upload ad aed Skeich @ axSsciSafeat Aunega 328p, IC
CBKOS Hed.
3580 senGeS! GSO Ardiuno Uno PCB S685 amma saxon Cod oS emda
Se aim Se aH Ardiuno Uno wooded qi Aimcga 328p, IC EeaG PCB gOded.
mem exaBeo yes shscn0 expmaaic,
Ardiuno Uno PCB GO @& Atmega 328p IC comacd goed GG00E ca od Sted
Boothload S588 GndGond eccac Stats og Ardiuno Une PCB ShdcH0 afae ooo.
coadnad sea gna sketch BS Gunde LED ACOs sem oSodad anSes—E
Ardiuno Uno sGeOed ac& Atmega 328p o@O) com galea Mads Bbeda exnfic
nie,
Qu
oo
a
-
aie
aes
16 MHz L_ <<
X-TalBOOTHLOADING 858 aa Ose ?
+ Ardiuno Uno sGedecl qoG ATmega328 / Atmegaiés IC comme anon
epgeGs emt sketch o ome meen momdcd IC Cone cemGS Boothloading
BS8 aga mead.
+ IC cewme Boothload GoeSE ATmega IC comma ne cto aft S680 cosy
Flash Memory eaoGecd. Ardiuno @ogmnooend Bom e@a egign® ocBedi B68 acm
Memory emoOacd sfc 28S.
+ Serecwed Sefton Ardiuno Uno S68dO@ 428 IC Com Boothload ad ech
&:Be Go mdaxd boothload mpaig aco.
Sema Stoded qx Atmega 328p | Atmegat68 IC coum eodind Beast oS
IC Cermed efadad ene8 ade gododet Oo gdeeced Sd Odd oma acted.
#pmsa0, Boothload meaaes.
Atmega 168/328p, IC Eaxmacd Boothload adosin gomda
QE 4G CD acSed BoothloadIC Samo me esky azo.
cma gisSaiss Aimega 168/328p, IC Comma Roothload S68 stm eaomakm
ceotad.
pqopoogo
ATmega 328p
z
3
:
=
=
g
g
leArduino ®i€2.09Gd asgige® G5®
Ariuing Gemeoed Gam eplae® sketch a eeo scH03. o88 sketch GOs6~ 35)
S8@0 MEDS gimded Ba sac. a edad Eon sketch esd eoige8a emod 4 mo
68Ro oxida,
|. Solara 08 mdSensce Header @@@ sav0ad Go. 00 emOEs egigeda
ome aoe ae, cme Fas sn} Se sosdes gon OR ae og’
BaeGO COsc9 oB4d Oo EomnSo oa. oe amoda emar800 ecpedt
ans,
2. Arduino Doecno ee8 mde conn afde Bat &@ meth BS,
3. Voild setup() aded a8 Sai vg Gexade emda,
888 exin® omds S6083 Gaxie fa 56 od Sto cond oeSfegi
omeishes 8s Sade,
4. Volld loop() cdedt see oede Guan Dose mmiie B80 ftbo omacast
gaBecS,
skeich ctl seine GO0GE OEbien Bthacid ate Smead sondd 3 oO eS xtc.
888 sande Sct a6 eOes Bao Bese SED SuIQwOS sald sketch oat eem@a exBa
888 amd 3 o ome Sts
1 Structure
2.Valwes (variables and constants),
3. Functions,
soha® G8sSE qs agen om ade on Beed Btho Asad Siipmsim goods sence
ag .
CEES egign® G8sSF com oufeha Bane Gta SOEs emexasion qooda cermdeg.
i semicolon
CS SES ee Saas COnmned Bie gan. 8685 28 Sohasd ont Statement & qSenency
GaSe. Used to end a statemeni.
CoMeddo Example :-
digitalWrite(ledPin, HIGH);
pinMede (ledPin, OUTPUT) ;
4! *f * Comments
cokowod GE0SE 08 oiGca coi eplgs® emda eae 56 otes aise8 Sa
aTdEo SOG CASED Cmead G6) Ears asia, 088 Bad eylgcdoad cha
BOeTHe cm coef eandsd acerdo.
10Gomssests are fines in the programme that are used to inform yourself or others about the way the
Se Faris. They are ignored by the compiler, and not exported ta the processor, so they don’ take
SB my space on the Atmega chip.
Ssossss aly purpose are to help you understand (or remember) how your program works or to
Bes SSS Pow Your programme works, There arc two different ways of marking a line as
ee
(Cece Example :-
=> 5, 9 This isa single line comment, Anything after the slashes is a comment
‘the end of the line
Se see Sasa GaSe Og one auton mmc Bass fad
* Sits is multiline comment - use it to comment out whole blocks of cade
Fi—xb—0}{ // single line comm
—
Ede forget the “closing” comméiit= they have to he balanced!
tis OK inside a multiline comment
/* but not another multiline comment - this is invalid */
{} Curly Braces
U SSE HSS enone 988 Erqmonen’ gar Sxemalsl, WEE GS Schon mie Boeke
eSS Sone Ggeo Sea god Boies cimesd ea dos Eumadd RADE geo.
‘Gaaty ‘Braves (also referred to as just “braces” or as “curly binckets") are a major pant of the C
fresramming language. They are used in several different constructs, outlined below, and this can
Sometimes be confusing for beginners.
2 opening curly brace "{" must always be followed by a closing curly brace "}". This is a condition
that is often referred to as the braces being balanced,
55620 Example :-
void serup()
{
pinMode(buttonPin, INPUT); /? button pin 3 is an input
}
void setup()
pinMode(buttonPin, INPUT);
pinMode(led, outPUT);
}# include
egige® ESS sag Soo ace 288 Siac enoes. SSS Stomaed Seda conn
Gemobe nes) cng velar ean0d Anihino Sxmmoed eB libmry om oclodnd gon,
G8 library omOd epigea0 3 B68 eSe Ecosse SemcecSn.
include js used to include outside libraries in your sketch. This gives the programmer access to a lange
group of standard C libraries (groups of pre-made functions}, and also libraries written especially for
Arduino.
‘The main referenee page for AVR C libraries (AVR is a reference to the Aimel chips on which the
Arduino is based)
ote that Kinelude, similar to #éefine, has no semicolon terminator, and the compiler will yield cryptic
error messages if you add one,
Cemom Example :-
#include // 6Sy Bunnenst Stepper 08300 GanmdOe sem agg
olga amie Library ass gino8, |
#include // 088 Bchesd servo e810 GenmcBS oc neg
eglged eee Library eos emad,
#include ¢/ o8@ Sihasadt LCD Display Ganache CORY
CINBe Sige como Libmry east eos,
pinMode()
PinMode() @Gei Arduino SORCAO grease cena ecBedgad oteoso Input_ eco |
Germain exaKade acoomnss Output cee Cin EOP cabp ow Cone BSS Beads.
Configures the specified pin to betiave either as an input or an oumput. See the description of digital pins
for details on the functionality of the pins.
Ge&xod) Example :- I
pinMode(pin, mode) |:
Pintiode (ledPin, OUTPUT); // sets the digital pin as output i.
pinMode{butten, INPUT); // gets the digital pin as output la
PinMode(buzzer, OUTUT); // sets the digital Pin as output =
Be * k
digital Write() p
digitalWite() 8823 Arduino steend. teeiace esi 85a BH og aia Ge sade |
See) og. SBE digitalWite Oe a® BS gas 0 wo) 5V ebiedom #06 eB 80 |
Sade. beB Se pe Bes been configured as an OUTPUT with pinMode(), its voltage will be set to the
Ssesspending value: SV (0r 3.3V on 3.3V boards) for HIGH, OV (ground) for LOW,
SB Se Ps configured as an INPUT, digital Write(} will enable (HIGH) or disable (LOW) the internal
Seb se Se input pin. It js recommended to set the pinMade() to INPUT_PULLUP to enable the
‘eeal pall resistor.
‘cesce Example :-
‘SeealWrite(pin, value)
SsgitalWrite(ledPin, HIGH); // sets the LED on 5V
SeitalWrite(ledPin, Low) ; // sets the LED off Ov
digitalRead()
SeeiResd) 883 Arduino cGedcd exeBmda os88 Cetom ( sensor) SBOa Sal aged
SSECSESS (OV ext 5V) Boe Be8,
Seaé Se value from a specified digital pin, either HIGH or LOW.
Cosce Example :-
digitalRead(pin)
‘aisdigitalRead(inPin); // read the input pin
GigitalWrite(IedPin, val); // sets the LED to the button's value
setup( )
Setup Function 8G) Arduino eteGa0 acBate comp a 2 Bastion 88 ao
SESE Soka craBee 08S BEo mos of. 888 sate cSodaed Gan moss
BSED Se cOcieOE Oo) Cast evan estGeg! omaeilen OG) Gaon 28,
Fsecton is called when a sketch stars, Use ito initialize variables, pin modes, start using libraries, ete
‘The setup function will only ran once, after each power up or reset of the Arduino board.
Comes Example :-
4st ButtonPin = 3; //butten connect to pin 3
(wold setup ()
ee finrtonrin, INPUT); // @0%0 BGS INPUT dole ease OO cate
button pin 3 ie an input
?
== led = 13; // led connect to pin i3
) #234 setup()
ReMece(LED, OUTPUT); // LED Adie Output cea Gmade 8 estos
13,
int buttonPin = 3;
int led = 13;
void setup ()
{
PinMode (buttonPin, INPUT) ; 888 side AE chods geod eS cen MoD
mordead Guada
PinMode(led, outPUT) ; edseseS clos aeaeac.
}
0¢0 BD ams a8 ann ( Inpur céscad ean sea) ani LED agaiadt ( Output
okumdad ofodeas etea) OS cence ofaeed Simo Ro Eat eam Soetmomad
FABRE ome oS,
688 Int cea agaiOated Integer Value gmat enOd ete ein enact 208
loop{)
208 Loop Function Eine amos €8i 8 mitted eansOelon gaat ( Loop ) ego
Geass.
After creating a setup() function, which initializes and sets the initial values, the loop() fisnetion does
precisely what its name suggests, and loops consecutively.
Gedo Example :-
int led = 13; // setup initializes serial and the butten pin
void set
{
pinMode(led, output}; // }
PODDDDDDD DEA Aceccececceece
void loop()
q
digitalWrite(13, HIGH) ;//e8@ Saoaecst 83 epl3 e8e) conaad SV Eooud
GOmEs age E88
delay (1000) ;// Hed mes aa ON oD
digitalWrite(i3, LOW) ;// 688 Bihsead ag 213 S888 Cenacd 0V Smdad
Gabor® eG ERR
delay (1000); // Bed men esc OFF «8
} | s>papperBBccecexecce
Loop 0) Ethene) eget AA 80 BB ei Q mbar Oo Led BOs ON = OFF BO eoumbcion
Bend, 4
if (conditional) and ==,
!=, <, > (comparison operators)
if Bihow mOnead S6eded oS Bal aqand emi SGsamD conad eA qecio® OBO sens
Sos aboot Bema Of Hemiacd GaBFEO ememasda.
SOBE COedn SOs Raa O8 GaP ede sdeacd 206d ae LED Odoadt ON
GOP oat ON 8 606 68 Coxmad OFF G68 oxi 288 if Bchas emomnes,
14SoS exed in conjunction with a comparison operator, tests whether a certain condition has been
ested sch ts an input being press,
De ee Ss be =e if some Variable is greater than 50. If it is: the programme takes a particular
Bee Pt ete way. if the statement in Parentheses is true, the statements inside the brackets are
fae Bee Se roamme skips over the code,
estes Say be omitted affer an if statement. If this is done, the next line (defined by the
Seis Becomes the only conditional statement.
este Example :-
Ss5 ledi = 13; // setup
Set leaz = 12;
ist button = 1
weid setup (){
PinMode{ledi, output); //
PinMode(led?, output); //
pisMode (button, input); //
i
DODD DDD DDD PAA BBccccccncccece
tializes serial end the led pin
Wem Siete ESeGE Led! Coione .led2 Cones ep button ae CEASE HBOS Sel ge
BS Se) cad t cen.
SSS ©) 6S GoremtalO: void setup) edess end08,
3 See S065 Button © 6B gcGimG (1 se) High ) e6sda0 eBBeld Ledi,Led? ON Bo
SSS dS.
B SS0 one ened moidede, cmon sxBa.
See Ress 28 Shin An Om mir . Bove aif gh Om BO eeacl a8 otaod Be
Bess SS 28880 oman orto.
+= {x = 120} digitalWrite(Leppini, HIGH) ;
38 (x > 120) digitalWrite (LEDpin2, HIGH) ;
32 (x < 120){ digitalWrite(teDpin3, HIGH);
af (x = 120)
=
digitelWrite(LEDpinl, HIGH) ;
digitalWrite(LEDpin2, HIGH) ;
Sec 85s if Dias ade wong atoo Bb axGa® else if Sabon sd 6 edad
Se DEGRHE Saemomad EmBerB 6B qed If wo else if BOveoed enon
15ifelse allows greater control oyer the flow of cade than the basic if statement, by allowing multiple tests
to be grouped together,
else can proceed another if test, so that multiple, mutually exclusive tests can be run at the same time.
Each test will proceed to the next one until a true test is encountered.
When a true test is found, its associated block of code is rum. and ‘the programme then skips to the line
following the entire iffelse construction. If no test Proves to be tue, the default else block is executed, if
one is present, and sets the default behavior,
Note that an else if block may be used with or without 2 ‘temminating else block and vice versa. An
unlimited number of such else if branches are allowed.
C@@0s) Example :-
af (x < 500)
: digitalWrite{LEDpini, HIGH);
jis if (x= 1000)
: digitalWrite(LEDpin2, HICH) ;
y
else if (x= 1500)
t
digitalwrite(LEDpin3, HIGH) ;
+
alse
{
digitalWrite(LEDping, HIGH);
for statements
for Sines Sted ag Gar eG o8 Secs ado mda ones ate exe emonacdtic,
‘The for statement is used to repeat a block of Statements enclosed in curly braces. An increment counter
is usually used to increment and terminate the toop. The for statement is useful for any repetitive
operation, and is often used in combination with amays to operate on collections of data/pins.
There are three parts to the for loop ineader:
For (initialization; condition; increment} [
C&acso Example :-
adaon $485 Weses GOES SUES sonce sclowdad anes,
// Dim an LED using a PHM pin
int PWMpin = 10; //
void setup()
{ // no setup needed
} 16‘oid loop()
_ { (initialization; condition; increment)
for (int i=0; i <= 255; Att) {
analogWrite(PWMpin, i);
delay(10); } }
SoigeSeod LED Gdham EdGa MSs coed enack.
void loop ()
: int x = 1;
for (int i= 0; i > -1; 3 = a + xt
analogWrite(PWMpin, i);
if (i == 255) x = -1;
delay (10);
mc loop Sch emia 6833 of mbacd emda Sgod een Baoe Bemdens
@22€ 26 condition od tho, See emt mos 6 £0 O8 Sgead sO coe
loop continuously, and infinitely, until the expression inside the parenthesis, ()
Something must change the tested variable, or the while Joop will never exit. This could
‘such as an incremented variable, or an external condition, such as testing a sensor.
while (expression) {
// statement (s)Cexoddo Example :-
var = 0;
while(var < 200) {
digitalWrite(LEDpinl, mTGH); 4) ;
vartt;
+
var = 0;
while(var < 100) {
thiag xepetitive 200 vimey
digitalWrite(LEDpini, HIGH) ;
digitalWrite(LEDpin2, HIGH) ;
vart+;
888 do Sthe emda 865 28 mbass C8805 68 aboa0 while Siva wad ent
mS Oi ome Semd Eo ade) eS. 08 cad oS maxcd Goa com asinread adden
Stead Ge08G, Ga mcOnei 83380 siete athe Gandia aeags.
Zh do loop works in the same manne: as the while loop, withthe exception thatthe condition is tested
at the end of the loop, se the do loop will ahways rum at least once.
do
{
// statement block
} while (test condition) ;
Coeds Example :~
do
{
delay (50); // wait for sensors to stabilize
x = readSensers(); // check the sensora
} while (x < 100); 685 100 Oma Bind opine come mca
switch / case statements
860 switch ...case Bibs emda eBs SoiaeEne O900 HEE COEDS NO HES sbignied
SSO chmtet esie cho Gunite B60 8808s Bes. switch statement Sa csed
Statement @ qcS DOes coon ech Fao cebalens mod.
SES Goad ebaQosens SS case statement & oped atce Gemd8. 088 switch Statement
oml0e yOtomed break Bann GBs exc, 80 Cihec OS aB6 osig2e emde =cDES0
Ses Eoae eshecB.
switel. case controls the flow of programms by allowing programmers to specify different code that
should be executed in various conditions,
In particular, a switch statement compares the value of a vatiable to the values specified in case
Sitements, When a éase statement is found whose value matches that oF the variable, che code in wha
case Statement is run,
18‘ide something when var equals 1
=
ease 2:
‘io something when var equals 2
break:
Sefault:
“nothing else matches, do the default
J) default is optional
data type
Hsled | BGOcc lig data Coos Oo eo GOS -128 BO 127. est) com ex}
Denia,
‘takes up | byte of memory that stores a character value. Character jiterals are written in
ike this: 'A' (for multiple characters - strings - use double quotes: "ABC"),
'# signed type, meaning that it encodes numbers from 128 to 127. For an unsigned,
+ > | byte( Sbits)
2 type that oveupies 1 byte of memory. Same as the byte dulatype.
‘datatype encodes numbers from 0 to 255,Arrays
Amy om 58es vacded OmgSs Oo ged GE som OB extcooneda.
is a collection of variables that are accessed with an index number.
Creating (Declaring) an Array
Amy esE80 ono geisha a8 enka onesie
C&6d Example :-
int mylnts[6];
int myPins{] = {2, 4,8,
char message[6}
string
scigiod Ga o8 guise ets LCD edkcom onl coommad ealIOO woes 8 BO es
OEIES GEO Cw Edlebo mandad eqloswed SSaqaa.
‘Tent strings can be represented in two ways. you ean use the String data type
cexacso Example :-
char Strl[15];
lh a,
wet,
U,
char Sir3[s
char Strdf ]
Bie quis Oe ono suileOs ganas sees esc
char myString{] = "This is the first line”
" this is the second line”
" this is the thierd Line ";
Comedy Example :-
char* myStrings[]={"This is string |", "This is string 2",
“This is string 3"," This is string 4", "This is string 5",
“This is string 6"};Project 01
Stcles go 01
S86 Sesace S35 4 80 @reBae LED dead BOxeB20 ON wo OFF ade qaandcs
o> 6S
Sem S20 emista ododo cassia,
A is]
Bee EI
Nee ARFE
Sk Noh
icnD | > Bee
fe] vin el ii
Fy eo} tom
e|al fa
ge
tl om
pe, |e) 5) of
we |") 3) Ge
Hg
3 <| 8
: {| if
He
Oo
SSS Gcso> esigss Wemuned adasi masa,
(/ Program 1: Making an LED blink on and off
ant 1ED = 8; // LED CONNECT TO pin @
void setup (}
i
PinMode (LED, OUTPUT); // tell Arduino the pin 10 1g an output
}
¥eid Isop()
t
sigitalWrite (LED, HIGH); // LED OW
delay (1000); // wait ONE second DELAY
digitalWeite (LED, Tow) ; #/ ZED OFF
delay (1000) ; // wait ONE second DELAY
}
SESS SSS ae igeia ees} sketch w emiddoas me “save ada.
SS Benes miniesed #86 eghgeSe emi sketch © verify/conpile mdefen,
SEES Em quia’ Sagmnmed om omed Ge Done compiling eg ernie
SS 886 Ardiuno S05e0 Upload moet,
88S 5680900 cog sketch @ CD aded LED ON OFF eg ene) we Folder me eae
=
21sSaiedo or 02
888 Cicheoed® Sei em $9100 One LED Aga 3 a POecHao ON a OFF wap
TOS sec Beg.
SC ace cos ealeda fede omen,
fo]
[5] tome,
EB ieaee
fe aa¥ ARFE
Hy Sy. GND
Blexo 2
ews
fash q
yl
eo
£ . 4k
rg Le?
9
es | § o
3 8] $8 |
5 oY 47 Lem
j
Sem qmedo eyknOs Gocon@ed SOmet ences,
int LED = 8; // LED CONNECT TO pin 8
int LED2 = 9; // LED connEcT To pin 9
int LEDS = 10:// LED CONNECT To pin 10
void setup ()
{
pinMode(LED1, OUTPUT}; // pin 8,5,10 Ig an output
PinMede(LED2, ouTpuT) ;
PinMeds(LED3, ouTPUT) ;
3
void loop()
4
digitalWrite(LEp1, arcH) ; // LED oN
delay (1000) ; // wait ONE second DELAY
digitalWrite(LED2, HIGH) ; ¢/ LED oN
delay (1000) ; (/ wait ONE second DELAY
digitalWrite(ZED3, uren) ; // LED oN
delay (1000) ; // wait O88 second DELAY
digitalWrite(LED3, Low) ; // TED OFF
delay (1000) ;
digitalWrite(LED2, Low); 4? LED OFF
delay (1000) ;
digitalWrite(LeD1, Low); // LED OFF
delay (1000) ;
}
Soe OD ee skelch @ CD tecBec! LEDI,23 ON OFF eee enkeh ec Folder ae
e28 quo.
22Project 03
Stiles fom 03
358 Stdlenett SH U6 15, eeGmd mE Baad eBaeat Bs om $0 eBeesD LED
S355 ON 560 mds eens
Saq= sae crcl oboSa comin,
e
|
Seon
SS SS scinc8s Geonmad const meso.
Sonst int butten = 1///pushbutton pin
sonst int LED = 8; //LED pin
int buttonstate = 0; // pushbutton status
void setup() {
pinMode (LED, oUTPUT) ;
PinMode (button, INPUT) ;
void loopt 1
¢/ read the state of the Pushbutton value:
buttonState ='digitalRaad (butter) ;
// check if the pushbutton is pressed
2 (buttonState == HIGH) {
// turn LED on:
digitalWrite(Lep, HIGH) ;
else { // 28 ecfn® ted S6Q0 OFF a
// ‘arn LED off:
digitalWrite (LED, Low);
ae800 Qot08. if Sihae smOBs Bes 2p
== HIGH) )e@ans LED! agac
28 (buttonstate = ErcH) ( Edis o8 qin’
// turn LED on:
digitalwrite (LED, HIGH):
,
ee Pees 856 sketch © CD ated BUTTON. Sec Emios cS Folder ae CRE ere,
23 .sicies aom 04
88 eitleeede Se ap 10
gD BE oad 500 a shosos ON om OF
88 cam Sen cite ofode canatn,
ee Bnd mo Once 28 ocfin® Ba exp 8,9 0 BAS) LED
F 680 exerted xB culgeas aang.
be Rese —
Hy Ss |
Hi = an
Elen | =
[| Eee 3 [am
y
i alee
wl El om |. oe eee
RF
as 8 =| 78
ae = <1 iff .
| | ow
7; o
are
Soo gnats eoigese Sconssd oda mdse,
int LEDL = 8; // setup initializes serial and the led pin
int LED2 = 9; // setup initializes serial and the led pin
ant button = 1;
int buttonstate
void setup ()
{
=0; ,
PinMede({LED1, OUTPUT); //
pinMode(LED2, OUTPUT); //
PinMode (button, INPUT); //
}
void loop {)
+
// read the state of the pushbutton value:
buttonstate = digitalRead (button) ;
if (buttonState == HIGH) // if button is pressed
{// if Odean emd8 80a 88 oc8 Sen eS.
digitalWrite(LED1, HIGH); // turn on ledL
delay (500) ;
digitalWrite(LED2, HIGH); // tuzn on 1ed3
delay (500) ;
M// Sed 88 exBeo® o8ecd LEDILED2 @@ ON/OFF megm 88 cxi08
else(buttonState == LOW)
{ digitalWrite(LED1, Low); // turn off ledi,2
} 1//Oe6 sasteGe08 LEDI2 BGO OFF mom sends com amines omO8ed ei58,
96 SbGomaO ene skeich co CD aSed IF ELSE sea ci&) oo6 Polder qq @asF ox.
24: Project 05
Stem eon 05
se St S38 o@ 0680 13 EcieD Gre Sind oxG LED Gdaxs G8sOesi ON S263 sep
Sod OFF aoe manded snd00 Sad eens.
28 Sem 580 ecabdo obeda anada.
set timer = 100; // The higher the number, the slower the timing.
eae tedFins{} = (0,1, 2, 3, 4, 5, 6,7,8,9,10,11,12,13};
st pinCeunt = 14; // the mimber of leds connect to pil 14
woid setun() {
for (int thisPin = 0; thisPin < pinCount; thiePine+) {
PisMeds(ledPins(thisPin], ourpur) ;
:
5
Feid loop() {
($982 eax0G2 LED 0.80 14 enith GsgedGe ON 958
Sez (int thisPin = 0; thisPin < pinCount; thiaPint+) {
SigitelWrite(iedPins[thisPin], HIGH) ;
delay (timer) ;
GigitalWrite(ledPins [thisPin], Low);
(SS =nOSS ON 8 ordi BE0HES OFF 20d
See (nt thisPin = pinCount - 1; thisPin >= 0; thiaPin--) {
S-gitalWrite(ledPins[thispin], HIGH);
slay (timer) ;
SgitalWrite (ledPins[thispin], Low);
SS eo ce sketch oo CD ated LEDI4 ON OFF eee emiéo a8 Folder @@ Sok
=
25sbsiedn eos 06
SRO cotamene wanegad Bed om 0.0 mreWms MB COE oaad OBe Digital As He 90
nome LED Ages magia Samta ead min made ona BEB.
28 ape cme gba ofoic omacin,
{@]
PPERERTA
Gens
ara
a
see Samp y
Ee
cree opm
fogcogoco—rodsoonong|
t
|
8
r 2 47k
An ee ue
a é a
10k Grea
Volum Hes a
Control
|
SOO Ehiisin ogigtis Qememsd eC moto,
int sensorPin = 40; // 08% ovemo anlog Gat aq 0 0 ere8ad aca
ant ledPin = 8; // LED connect te gigita pin 8
int gensorValue = 0; // variable to store the value coming from the
Sensor
Void setup{) {
PinMede(ledPin, OUTPUT); // ledPin as an OUTPUT
3
void 1oopt) (
sensorvValue = analogRead(sensorPin); // O6e cogae MORO Bat pect
O8anaB ad the value from the sensor
digitalWrite(ledPin, HIGH); // turn the ledPin on
delay(sensorValus); // Seg goo ogm goo Al ao Hod goed gos
& (sensorValue) 900 ea Mavens 68 aga eof BO // turn the
ledPin of¢;
digitalwrite(ledPin, Low) ;
df
delay (sensorValue) ; fo¢ wos ag goa Ad eno Sch ehadgan = fed
& {sensorValue} FD SED qpagens 69 apa aS BO // turn che
}
OS Gbeonad gee sketch © CD aed Anlog 06 ec36 eS Polder g@ @aat exen,
26Project 07
Stiisem com 07
ase BF ¢Q 00 areas eB BosBE Covoms (sensor) Bs eceder
SSS Sidsacct
Se Asiaing Soest UG serial monitor Window o8 cbmena poner mda ome deg,
8 Sem S20 Gaede obede oma.
re [a]
GEEEEEEE)
para
a
28
EROS
i) slolestoter
see wtomypy
Conair
BRT
oO
SSO SSE sshnede Sannsd clod mdsio,
({) Program 7: Make Arduino teint “Hello World’ to computer
woid setup() {
Serial begin(9600); // open
9600 baud communication line to
computer
}
woid leop()
‘
Serial printin(“Hello” write the word “Helle*
delay (1000) ; wait a second
Serial.printin("World”); // write the word “world”
delay (1000) ; // wait a second
}
So a 2F HS serial monitor Window @& x88 cqam Siegmmosd om ses) Uc
Biss 25255 Sc Open aoooeGe. egigegs Ardiuno woecco upload — mdetep, Serila
(Mier $82 26 cco Ec8o ede ohio oxSe.
Serial Monitor
27SScisen gow 08
688 cidamed, qa Gs ap 00 arcSad oS Se) mencd cred adacsset
saddle siigdamOad em Digital Ga em 8 0 cSag LED Gdca Siemda m oS
siigdass eae Arduino Gxemomsed eG serial monitor Window o® cians. adacinn
NOS mc Dew.
Soe emisia oteos onmaka.
SDD Gibede spins Somoesd cons adeko,
void loop {
(I read the analog in value:
sensor Value = analogRead(analogInPin);
{f map it to the range of the analog out:
output Value = map(sensorValue, 0. 1023, 0, 255);
ff change the analog out vatac:
analog Write(analogOutPin, output Value):
// print the results to the serial monitor:
Serial. print" sensor = * j;
Scrial,print(sensorValue);
Serial.print("\t output =");
Serial printin(outputValue);
Arduino @i§SieS66S oS serial monitor Window @2) GBS oem Sscmmasd sno coat
mG Ble SSS Sc Opn ndooania, ogkeSe Ardiuo oS05c0 upload mado.
Serila Monine SSS 2S cco Gada emda ea mofo.
a
eee |
068 SSésac0 coe sie 2 OD seSed ANALOG LED SERIAL cea ent) 6 Folder ge
GRE wo.
28‘Project 09
SSciew com 09
Se Slee moe Sei yo 08 meBnd es S68) exgnad sesod oxarkses 0V
SS SVDC Beaded chacica Arduino Saetmcoss) seria) Monitor window 8 cheas ‘toaadeny
Seco sm Ses.
96 Se S50 Excite O80 acai:
| Fa
i a] #
El sm
—=s 41 ae. Eig
ow «| Bee || gy SE
od el:
or i
SS Saks esiarle Seammed lens tndat,
ant sensorValue = 9
void setup() {
Serial begin (9600); // initialize serial communication at
$600 bite per second:
}
¥oid loop() {
int sensorValue = analogRead (Ad) ;
. //xead the input pin 0:
| // Convert the analog reading (w
hich goes from 0 - 1923)
to a voltage (0 - sy);
float voltage
worValue * (5.9 / 1023.0);
Sesser Prtntth (voltage) ) (i point value en aabisinadi toc:
+
See SSSSSe & Arduino Gxgmomced ZG serial monitor Window 206 com goede
‘St besd rate cms Gad @me@ Serial begin($609)
SSSSs rial monitor Saetyss onfal axnBa sci,
‘S2t sensorValue = analogRead (AQ) 058) mgma OG AQ © @@sem
tm (0 8 SV) goo int sengorValue = analogRead(A0); OGa G08.
BE Seems mag Gane 809 axdbe 088 Ethoses Gemss
(SSeat voltage = sengorValue * (5.0 / 1023.0); 683.
= Serial.printin (voltage) ed Oud mda age 688
-Printla(voltage); Sdaess a8 ocB
sOeskeich @ CD oxded ANALOG PRINT o0% cep ec Folder Re ohe
29Project 10
sSaieso gor 10
300 wiciemecle cxaegss BS ap LMIS/35 EelenOG@ sensor Comacd Hood 08 ed
bg Cello goad gcse Clete sme S00 58 cos Anduino Gemawad ao
Serial monitor window 98 qBeee B80d G50550 eeG ad Gch LED edad ent Sed
Cowocd ON G600 nef esigesad sadacg.
SOGE vod emg CScad Se Seo 1D Cemiia kd oa LED @@&xseF eon} Gog
Cevowad ON 6B,
88 Sem one ExckDe cfeda eneain.
is)
bi |
Is | (eer
= PR i 5 f
Be| |e ii) ee)
Oo o
San Guehen ockgwa Srememed aoe acai,
const int sensorPin = AQ;//LM35 / M36 cecbad oa Bai ens
sonst float baselineTemp = 20.0)// esd cusg caléici) Fao
apt LED = 6; // int relay = 8;//LED connect to pin 8
void setup ()
{
Serial .begin (9600) ;
PinMode (LED, OUTPUT) ;
digitalWrite(LED, Low);
}
void Loop ()
{
// read the value on Analogin pin 0
// and store it in a variable Sensorval
ant sensorVal = analogRead{sensorPin) ;
Arduino Sagmooaned a8 serial monitor window e8 Bt em 0 0 e@e goo iene 585
Serial.print ("sensor Value: ");
Serial.print(sensorVal) - 30Chad LM36 @ sensor ed eOieCaan mans 280g eoad G00 mh
// convert the apc Feading to voltage
float voltage = (sensorVal / 1024.0) + 5.0;
G8 gO serial monitor window cB hans 660
{/ Send the voltage level out the serial Port
Serial.print(", volts: ");
Serial print (voltage) ;
205 LM36 c sensor ect eOigSam GOS soailegS eoas a0 md89
f/ convert the veltage to temperature in degrees c
U7 the sensor changes 10 av per degre
/? the datasheet Says there's a 500 mv offset
f/f (Uwolatge - 500mV) times 100}
Serial.print(", degrees c: ");
float temperature = (voltage - .5) + 100;
Gthad ebidlom goed 0.55 cy BOUG 88 aes 100 3 qmStes eee Bemod
df (roltage - -5) * 100;
288 exc serlal monitor window 8 etwas B60
Serial printin (temperatura) ;
EMSS “setsor ene! @rs@eo. CBanie = eos cong pdmaios ang otndiras 06 de) Eb
OEP en BS B08 cox e288 LED Boa ON Soeud decd eneae LED 823
OFF 858005 coond @@necd.
// 4f the current temperature is lower than the pre-set
temparture turn off all LED
if (temperature >= baselineTemp + 1) // 70 1 BE eaE ees ao
{
digitalWrite (LED, HIGH); // LED gaa ON G68
}
‘ise if (temperature < BaselineTemp) // oom 1 Gat Sc8O) ached
digitalWrite (LED, tow); LED adic OFF G6
delay(20); delay for 20 ms
}
88S BSEHGC Hee sketch = CD aces LM35 TEMP CONTROL ees ect ac Folder eg
ORE Grn, _Project 11
sSaieda om 11
LOD B8c8et Ardiuno a6ad0 en o88at) adnsin maxis en LCD 8860 Boy qakediaom est
2S G0us adasiny mane oma Bef,
‘Ardiuno Progeanming
98 com ome exiles steda cocde,
if
in
{s)
oe eo
ema
GRIESE)
onaureuore
Bevis
it
BS
Ko o~
ome existe egigns Hngoamed stead mc LCD Sbrs6 ("Arduino Programming ")eqe
Sted méoda oon sma BEG
#include e863 LCD Library © sO Sarma emnad,
LiquidCrystat fed(12,11,3,4,3,2): / LED gSdc08 ect
RS =12 E11, D4=5, DS-4, D6-3, D7=2
Oe e@ Ardiuno Cheted or 8 oS 83 om Gemeand cae sed.
void setupi)
{
led.begin(16,2); LCD eecre® 16 x2 Bosd commas 20 waS cB.
}
void Inop()
{
led.clear(); / LCD g8cc0 GOs} agus 0 exfia® 60 ¢05 ado cen eae ef.
led setCursor(0,0): #/ made LCD cOd000 Se0 cana.
Icd.print("Arduino Programming "}; / #88 tees LCD ise sre ode cea ead
oc
delay(1000}, Bar | m meas 8O8 Oxfio LCD see amen opad mea
aenned 80 LCD gituts d0 Oxfis 200 B6COs ca® off,
led.clear();
led.print("Good Moming"); / 688 Szfes LCD eocce® Stes mda cos cad eB.
delay(1000); e531 o> mead «88 eo LCD ges oabeda een med
Gomaec! So LCD BASrsEs 68 S:a oc BOED gy aOadd qin slo om cee
OSES oc.
i
988 Ghost eng sketch o CD aed PROJECTS 8G Eto ce Folder edi
LCD DISPLAY ag ean? acm,
32Soe go 12
088 ciciumede caved 65 g@ LM35 2 CesodOGom sensor Conamod eeSind OB ved
srng ESmdo enc ge Cdincioo eae GCHO 88 O LCD( 16x 2) BodcoIm chon
500d S60 LED Addon ani tag cenmed ON O60d mendoe a exlarSacd mee
ads.
@ od sine Caen) man 35 65. 68 ge 8) een | od edandOe aS O 50
LED adied en) Ged coxaasl ON 590 see® aco.
Seo ended ofeda sansa,
TEMPEEAI IRE 2B ES
Mss na |
hey
, we
Commarea
BEE
aipoauy
NG earl
Sao erie esignea Shermosad atmst adeden,
flinclude // LCD ( 16x 2) oOd:80 library sO eoaad
int reading = 0;
int sensorPin = ag; //LM36 edde me Sst eos
int relay =7; // Geg comma 58S 85 ope
Liquidtrystal lced{11, 12, 5, 4, 3, 2);//LCD code Sd ag fda
ade
void setup() {
led.begin(16, 2); led pidced Sas
pinMode (relay OUTPUT); Ceg E550 Go0 adaysd output see BO coa® of
}
void leop() {
reading = analogRead(sensorPin); //LM35 Salo
aint celsius = reading/2: // Seb ema 2 a cao
led.setCursor(0, 0};
lod-print({"Temperature: ");
lod. setCursor (0,1);
led.print (celsius, DEC);
led.print("c");
if (celsius >35) {//csimdOoa gomm 35 Ot guage |8 fed Con ON S68
digitalWrite (7, LOM) ;
digitalWrite(7,HIGH) ;
}else { // Sec ania Sed conga OFF S680 coscc Fo
digitalWrite(7,LOW) ;}
delay(500); Sed man 58 osisd 500 aga axnBs
led.clear(); }//LCD scx clear S59
88S S209 spe sketch o CD oOsg LCD LM35 TEMP CONREOL 6@8 Edith aa
Folder m@ Garé efor.
33Odes efor 13
0S Ciciecned® megs Sal ag 0 SEs afedad quia Wittamia esas 68
Gee LCD (16 x2) Goda sedbad oxB epignoad sadada mmdo ecoas Bes
98 Hm ome cree ofods oneal,
a
+ input as
ig
ORV DC
me
a
as
pu ae
lam iy
ea
=
q
a
?
O-
San eaiede egiguea Gemoned alee mésion.
include
LigquidCrystal led (11,12,5,4,3,2);
int analoginpyt = 0;
float vout = 0.0;
float vin = 0.0;
float Ri = 100000.0; // resistance of 100K
float R2 = 10000.0; // resistance of 10K
int value = 0;
void setup() {
pinMode(analogInput, INPUT);
led.begin(16, 2);
Jod.print("DC VOLTMETER") ;
}
void loop(){
// vead the value at analeg input
value = analogRead(analoginput) ;
vout = (value * 5.0) / 1024.0;
vin = vout / (R2/(R1+R2));
if (vin<0.08)
{
vin=0.0
}
led.setCursor(0, 1);
led.print ("INPUT v=
led.print (vin) ;
delay (500) ;
888 Shand aoe sketch @ CD mcSec VOLT ME
@ane gun.
ER 8G e800 aS Folder aq
34Project 14
soaien goo 14
288 ottiemed= quneext Gs} ag 0 O eeeBme LM35 CoOxnecd B83 caida
SGeed 69 cdind® pace wae steccd abms mG DC esi0dca Ysa Bes Mean
ded egigeiad sndade mumdo oma He9,
—I{el
ance
5
| i
ali
ae
4
\ LG pl
Hi oa a
le eee cpSe
: x
Seo cooeta sslenOs Greamomed sles mda,
#include //source:olled-temperature/
LiguidCrystal led(11,12,5,4,3,2); //library initialization
int tempPin = a0; // the output pin of LM35
int fan = 3; // the pin where fan is
int led = 7; // led pin
dnt temp;
int tempMin = 35; // the temperature to start the fan
int tempMax 50; // the maximum temperature when fan is at 100%
int fanSpee:
int fanLcD;
int 1drzep;
led.print ("TEMP: %);
led.print(temp); // display the temperature
led.print("C “);
/f/led.print (“LIGHT”) ;
led.setCursor(0,1); // move cursor to next line
/fled.print (“FAN: %);
led.print(fanLcD); // display the fan speed
led.print("8");
led. print (sensorValus) ;
delay (200);
icd.clear();
}return temp * 0.48828125; }
66 GbOrn00 ee sketch G CD acded TEMP FAN CONTROL e@a ems ext Folder @
35Sésiem gom 15
e8S cScieaed’ Ardiuno Uno sSudam0 eeSoe KEY PAD asd enancenel Gorn
Serial Monitor od ede mcotzn exmde exon 2e8.
98 eee cme Erietis aSedo onsets,
eee
8
Se0020 00)
Seki
i
agg
(oemmayuioic:
BERREE
aEOI¥
See Etishn syle cmos CSF com oOdes9 (Key pad) 1,23,A oe coo wy exfecs
OF qxfin® SS Serial Moniotor ed edna aden cen GicmMaS eae eG.
void loop()
{
digitalWrite (ri, LOW);
digitalwrite(r2,HIGH) ;
digitaltrite(r3,H1GH) ;
digitalirite(r4,HIGH) ;
colmi=digitalRead{c1) ;
colm2=digitalRead (2) ;
eolm3=digitalRead(c3) ;
colm4=digitalpead{e4) ;
if (colmi==10W)
{Serial.printin("1") ;
delay (200) ;}
else{
if (colm2==LOW)
{Serial .printin("2") ;
delay (200) ;}
else{
if (colm3—=10W)
{Serial.printin("
delay (200) ;}
else{
if (colm4==Low)
{Serial printin ("Aa") ;
delay (200) ;
yddHE
288 Sbiracd woe sketch @ CD axed KEY PAD DISPLAY 86 Ema Gch Folder ae
RE yon.
36Project 16
eSiledo poe 16
999 cGsismest Ardiuno Uno oSsaamd. eee8oe KEYPAD ad aisdecs! DC eJOcam
2000 Mens mde pedo cam Bey,
88 axmone conse séeds emass,
s||' key pad
A 2 21) ai)
Ete 2) (31 f6) La)
i e207) 1 (9) fe)
al al (a) (6) Lf)
a\ ¢
SoraZS)
me. SD) Frosor
ee
he
ne Exlsben ong amide OGal maa neces (Key pad) 1.23.4 cep cot 68 qa’ Oo
SO GeaxeES eSiived Bos HENS Mon age Cremnoncd cre off
void loop()
digitalwrite (21, LOW) ;
digitalWrite(r2, HIGH) ;
eolmi=digitalRead(cl) ;
Golm2=digitalRead(c2) ;
colm3=digitalRead(c3) >
solma=digi talRead (cd) ;
if(colmi==Low) /fehecks whether key "1" is pre
{ analogWrite(pwm,42)/ // writes "42" (duty cycle 164) .
delay (200) ;} F
else
{
if (colm2==10H) //checks whether key "2" is pressed.
{ analogWrite(pwm,84); // writes "@ (duty eyele 32%).
delay (200) ;}
else
t
if (colm3==L0") //checks whether key "3" is pressed
{analogWrite(pwm,126); // writes "126" (duty cycle 48%).
delay (200) ;} i
else
{
if (colm4==LOwW) /? cheeks whether key"A" is pressed,
{digitalWrite(pwm,Low);// (duty cycle 08) .Motororm.
delay (200) ;}
dEEH
S80 Gkeroao cexg sketch i CD exxCuch KEY PAD MOTOR SPEED see exfo ecé Folder
Re CE es.
370 © me8ne 10k S68 exeaarh mincsedd DC
e@iides gen laa meso Ses 66 Bac LCD pike cosla® adesisy quandosd
-- FAN RPM METER --
120 RPM 23%
ane ARAPAGAAAS AAR a
= el 1 BREE ele
i | 8 2S es ee a
s 2
:
£
sae gulede eqlos Giemonsd cone aban.
void leop(}
[
delay(1000);
detachInterrupt(0); didetaches the interrupt
time=millis(}oldtime: —_//finds the time
rpin=(revitime)*60000; calculates rpm
oldtime=millis(); /isaves the current time
rev=0;
valuc+analogRead(pot}; _//reads the speed control POT
valuc=valuc/4;
analogWrite(pwm,value); —_//sets the desired speed
percent=(value/255)"100; finds the dury eyele %
Icd.cleart);
led.setCursor(0,0);
led.print("_FAN RPM METER_");
Icd.setCursor(0,1);
lcd, prini(tpm),
ted.print(" RPM");
Jed.print(" ");
led. print(percent);
Icd.prini("%");
attachinterrupt(0,ist, RISING);
3
260 SSencO woe sketch G CD ached FAN RPM METER ees estén ex Folder
QE cam.
38Project 18
staan Gom 18
Ardiune oSeda0 exSoumd SERVO MOTOR Ged idk ace tenes gpihdess
SESS tia noo monte sm Bee.
96 GES) omD Erisble SEods opede.
te
ea oe
aay MeToR
ave
CoRmorrio
|
See5
a
a
viemry
ok
SEtboR
SREP Geiser]
0
oO
ie
Gio qilaia esioves @eanmed acme make
Finelude /e9S2 Servo moter , Librayo 28 Soemone oom,
Pee myservo; J ept@eest e8lo6a 25 qdfoo Sted sofa OD gas
ae!
int potpin = 0; i 10k potentiometer GN ANALOG PIN 0
int val; #/ variable to read the value from the analog pin
void setup()
ervo.attach(8); // servo on pin 8
void foop()
t
val = analogRead(potpin); if reads the value of the potentiometer (value between
Oand 1023)
val = map(val, 0, 1023, 0, 180); 17 scale it to use it with the servo (value between 0
and 180)
myservo.write(val); # sets the servo position according to the scaled value
delay(15); Hi waits for the servo to get there
}
A NOk oS mene er2eO momBetel eeIdS gomo 0 EO comm 180 eal
sromd BOmG B6EED chic.
288 SiGac0 ee sketch @ CD axed PROJECTS e@u emi) ac Folder ed
SERVO PSN o@ @an€ acm.
39Project 19
sésiee som 19
Ardiuno OSoOad eubesas SERVO MOTOR 2 oi 10k Oe enem 2 oS qrdioonss BEGO
i) S680 o8ine memG cH eawOt Am emiad can asim made om a¢8.
28 Sem Smo enisfa cicta cans,
(emnadruiore
SOO GTOT cai ouMCHe SERVO MOTOR gmea B6d0 © Bodo gene
void sctup()
Horizontal: Servo.attach(ServoHorizontalPin):
Vertical Serve.aitach(Servo VerticalPin);
i
void loop)
{
HorizontalPotValne = analogRead(HorizontalPotPin):
VerticalPotValue = analogRead(VerticalPotPin’ D5
HorizontalServoPosition = map(HorizontalPotValue, 0, 1023. ServoH_Min,
ServoH_Max);
VerticalServoPosition =map(VerticalPotValue, 0, 1023, ServoH_Min ,
ServoH_ Max);
HorizontalServo. write(HorizontalServoP osition);
VerticalServo, write( VerticalServoPosition);
delay{20);
}
888 GSGa50 gme sketch o CD acted PROJECTS sea gaidy qo Folder ed
2 SERVO ARM o@ eat exo.
40Project 20
ofiiess gom 20
Antiunc eSeOnes exBrece Ou 5 af ae6 Stepper moto Uni polar motor } ees @EO 2
SB! B2)extacscs scons Sie ode pada sm DOW,
soe guste obese enedio,
Bl Oss SGsSci com eniesin
S8IGe Oo Mone SSO
eaves
888 StHacd goe sketch
oh pee |
— ([ @
Lome si | ie?
ee
Bie ae ‘5 Wire
€NB | > zl Stepper Motor
eee ye]
ad
we | el al é
mE:
i “13g
° 3
|
|
qONGGO Ardiuno SBoted 291011 Bs yp oes
ogimSo own eabta emda) 68a crc
yall = digitalRead(button_1); // o@@O B1 Oe 28 ached otakey wed.
if (val! = HIGH)
1
digital Weite(motorPin], HIGH);
digital Write(motorPin2, LOW);
digital Write(motorPin3, LOW);
digital Write(motorPir
delay(motor_ Speed);
1, LOW);
ital Write(motarPin2, HIGH);
ital Write(motorPin3, LOW};
digital Write(motorPind, LOW);
delay(motor_Speed);
digital Write(motorFin 1, LOW);
digital Write(motorPin2, LOW);
tal Write(motorPin3, HIGH);
digital Write(motorPin4, LOW);
delay(motor Speed);
digital Write(moto:Pin1, LOW);
digital Wrive(motorPin2, LOW).
digital Write(moto:Pin3, LOW),
digital Write(motorPin4, HIGH):
delay(motor Speed);
Uni Polar Stepper Motor Be @BLE econ.
Heike mde28S qEe eBiedam
@ CD oaxdes PROJECTS e@m esi) aed Folder ect
41