scientificArduino.pdf
(
4572 KB
)
Pobierz
SCIENTIFIC ARDUINO PROGRAMMING
Arduino programming for scientists
A free addendum to ”Scientific Programming”
GIOVANNI ORGANTINI
Sapienza Universit` di Roma & INFN–Sez. di Roma
a
March 4, 2016
Contents
zero
Introduction
zero.1
What is Arduino?
. . . . . . . . .
zero.2
What this booklet is intended for
zero.3
How to use this booklet
. . . . .
zero.4
Supporting this work
. . . . . . .
5
6
7
7
7
9
9
11
13
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
due
How Arduino works
due.1
Arduino basic architecture
. . . . . . . . . . . . . . . . . . . . . . . .
due.2
Program development
. . . . . . . . . . . . . . . . . . . . . . . . . .
due.3
Using Arduino on Linux
. . . . . . . . . . . . . . . . . . . . . . . . .
tre
Arduino basic programming
15
tre.1
The first Arduino sketch
. . . . . . . . . . . . . . . . . . . . . . . . . 15
tre.2
I/O with Arduino
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
tre.3
Showing data
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
quattro Program execution control
19
quattro.1 The selection structure
. . . . . . . . . . . . . . . . . . . . . . . . . . 19
quattro.2 The iteration structure
. . . . . . . . . . . . . . . . . . . . . . . . . . 20
sei
Saving data
sei.1
Using Serial communications
. . . . . .
sei.2
Connecting to the Internet
. . . . . . .
sei.2.1 Configuring the Ethernet shield
. .
sei.2.2 Using the Ethernet shield to collect
sei.3
Using an SD card
. . . . . . . . . . . .
23
23
27
28
30
34
. . .
. . .
. . .
data
. . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
sette
Arduino specific functions
37
sette.1
Setting up pins
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
sette.2
Writing and reading digital pins
. . . . . . . . . . . . . . . . . . . . . 38
iii
sette.3
sette.4
timing
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Analog pins
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
42
42
45
45
50
54
56
57
66
otto
Measuring with Arduino
otto.1
Voltages
. . . . . . . . .
otto.2
Distances
. . . . . . . .
otto.3
Temperature
. . . . . . .
otto.4
Light
. . . . . . . . . . .
otto.5
Magnetic field
. . . . . .
otto.6
Acceleration
. . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
1
scientific arduino programming – Vers. March 4, 2016
©
2015 Giovanni Organtini, Sapienza Universit` di Roma & INFN–Sez. di Roma
a
This work is licensed under a Creative Commons Attribution–
NonCommercial–NoDerivs 3.0 Unported License. You can find all the
details about this license on
www.creativecommons.org
for details. You
are free to copy, distribute and transmit this work. You must attribute the
work as a work of Giovanni Organtini (giovanni.organtini@uniroma1.it),
who does not endorse you or your use of this work. You may not use this
work for commercial purposes. You may not alter, transform, or build upon this work.
You can support the development of this manual by making a donation on
PayPal
using
the e–mail address
giovanni.organtini@uniroma1.it.
This work was partly supported by
Farnell Element14
who kindly provided some of the
parts described in the text.
Contacts:
Prof. Giovanni Organtini
Sapienza Universit` di Roma
a
Dip.to di Fisica
P.le Aldo Moro, 2
00185 ROMA (Italy)
Tel: +39 06 4991 4329 Fax: +39 06 4453 829
e–mail:
giovanni.organtini@uniroma1.it
Plik z chomika:
jacekplacekjacek
Inne pliki z tego folderu:
Arduino(1).pdf
(35793 KB)
Arduino.pdf
(35793 KB)
SFE03-0012-SIK.Guide-300dpi-01(1).pdf
(31943 KB)
SFE03-0012-SIK.Guide-300dpi-01.pdf
(31943 KB)
Beginning C For Arduino (2012).pdf
(27633 KB)
Inne foldery tego chomika:
Asembler
C++
DirectX
GDB
Gdi
Zgłoś jeśli
naruszono regulamin