Programming Arduino: Getting Started with Sketches 3rd Edition Simon Monk pdf download
Programming Arduino: Getting Started with Sketches 3rd Edition Simon Monk pdf download
https://ebookmass.com/product/programming-arduino-getting-
started-with-sketches-3rd-edition-simon-monk/
https://ebookmass.com/product/programming-arduino-getting-started-
with-sketches-third-edition-simon-monk/
https://ebookmass.com/product/programming-arduino-getting-started-
with-sketches-tab-monk/
https://ebookmass.com/product/programming-arduino-next-steps-going-
further-with-sketches-2nd-edition-simon-monk/
https://ebookmass.com/product/programming-the-raspberry-pi-third-
edition-getting-started-with-python-simon-monk/
Programming the Intel Galileo: Getting Started with the
Arduino -Compatible Development Board Christopher Rush
https://ebookmass.com/product/programming-the-intel-galileo-getting-
started-with-the-arduino-compatible-development-board-christopher-
rush/
https://ebookmass.com/product/hacking-electronics-learning-
electronics-with-arduino-and-raspberry-pi-2nd-edition-simon-monk/
https://ebookmass.com/product/getting-started-with-sql-and-databases-
managing-and-manipulating-data-with-sql-mark-simon/
https://ebookmass.com/product/programming-the-photon-getting-started-
with-the-internet-of-things-rush-christopher/
https://ebookmass.com/product/programming-with-stm32-getting-started-
with-the-nucleo-board-and-c-c-donald-norris/
Programming Arduino®
Getting Started with Sketches
THIRD EDITION
Simon Monk
ISBN: 978-1-26-467888-4
MHID: 1-26-467888-6
The material in this eBook also appears in the print version of this title: ISBN: 978-1-26-467698-9,
MHID: 1-26-467698-0.
All trademarks are trademarks of their respective owners. Rather than put a trademark symbol after
every occurrence of a trademarked name, we use names in an editorial fashion only, and to the benefit
of the trademark owner, with no intention of infringement of the trademark. Where such designations
appear in this book, they have been printed with initial caps.
McGraw Hill eBooks are available at special quantity discounts to use as premiums and sales promo-
tions or for use in corporate training programs. To contact a representative, please visit the Contact
Us page at www.mhprofessional.com.
Information has been obtained by McGraw Hill from sources believed to be reliable. However, be-
cause of the possibility of human or mechanical error by our sources, McGraw Hill, or others, Mc-
Graw Hill does not guarantee the accuracy, adequacy, or completeness of any information and is not
responsible for any errors or omissions or the results obtained from the use of such information.
TERMS OF USE
This is a copyrighted work and McGraw-Hill Education and its licensors reserve all rights in and to
the work. Use of this work is subject to these terms. Except as permitted under the Copyright Act of
1976 and the right to store and retrieve one copy of the work, you may not decompile, disassemble,
reverse engineer, reproduce, modify, create derivative works based upon, transmit, distribute, dis-
seminate, sell, publish or sublicense the work or any part of it without McGraw-Hill Education’s
prior consent. You may use the work for your own noncommercial and personal use; any other use
of the work is strictly prohibited. Your right to use the work may be terminated if you fail to comply
with these terms.
THE WORK IS PROVIDED “AS IS.” McGRAW-HILL EDUCATION AND ITS LICENSORS
MAKE NO GUARANTEES OR WARRANTIES AS TO THE ACCURACY, ADEQUACY OR
COMPLETENESS OF OR RESULTS TO BE OBTAINED FROM USING THE WORK, INCLUD-
ING ANY INFORMATION THAT CAN BE ACCESSED THROUGH THE WORK VIA HYPER-
LINK OR OTHERWISE, AND EXPRESSLY DISCLAIM ANY WARRANTY, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO IMPLIED WARRANTIES OF MERCHANT-
ABILITY OR FITNESS FOR A PARTICULAR PURPOSE. McGraw-Hill Education and its licen-
sors do not warrant or guarantee that the functions contained in the work will meet your requirements
or that its operation will be uninterrupted or error free. Neither McGraw-Hill Education nor its licen-
sors shall be liable to you or anyone else for any inaccuracy, error or omission, regardless of cause, in
the work or for any damages resulting therefrom. McGraw-Hill Education has no responsibility for
the content of any information accessed through the work. Under no circumstances shall McGraw-
Hill Education and/or its licensors be liable for any indirect, incidental, special, punitive, consequen-
tial or similar damages that result from the use of or inability to use the work, even if any of them has
been advised of the possibility of such damages. This limitation of liability shall apply to any claim
or cause whatsoever whether such claim or cause arises in contract, tort or otherwise.
To my boys, Stephen and Matthew,
from a very proud Dad.
Preface ..................................................................................................... xi
Acknowledgments ................................................................................. xiii
Introduction ........................................................................................... xv
vii
Constants ............................................................................................... 37
Conclusion ............................................................................................. 37
3 Functions .......................................................................................... 39
What Is a Function? ............................................................................. 39
Parameters ............................................................................................. 40
Global, Local, and Static Variables .................................................... 41
Return Values ......................................................................................... 44
Other Variable Types .......................................................................... 45
Floats ................................................................................................. 45
Boolean ............................................................................................. 46
Other Data Types ............................................................................. 47
Coding Style ........................................................................................... 49
Indentation ........................................... 49
Opening Braces 50
Whitespace 50
Comments 51
Conclusion 52
6 Boards .............................................................................................. 87
Arduino Nano ....................................................................................... 87
Arduino Pro Mini ................................................................................. 89
Breadboard ............................................................................................. 90
The Boards Manager ............................................................................. 91
ESP32 Boards ......................................................................................... 92
Raspberry Pi Pico ................................................................................... 95
BBC micro:bit ......................................................................................... 96
Adafruit Feather System ...................................................................... 98
Conclusion ............................................................................................. 99
The first edition of this book was published in November 2011 and has been
Amazon’s highest ranking book on Arduino.
The Arduino Uno is still considered to be the standard Arduino board. However,
many other boards, including both official Arduino boards (like the Leonardo,
Nano, and Pro Mini) and other Arduino-compatible devices like the Raspberry Pi
Pico, ESP32-based boards, and numerous Feather boards from Adafruit have also
appeared.
The Arduino software is available for so many families of microcontroller, that
it has become the environment of choice for many embedded programmers.
This edition also addresses the use of Arduino in Internet of Things (IoT)
projects and the use of various types of display including OLED and LCD.
Simon Monk
xi
I thank Linda for giving me the time, space, and support to write this book and
for putting up with the various messes my projects create around the house.
Finally, I would like to thank Lara Zoble and everyone involved in the produc-
tion of this book. It’s a pleasure to work with such a great team.
xiii
xv
The basic boards are supplemented by accessory shield boards that can be
plugged on top of the Arduino board.
The software for programming your Arduino is easy to use and also freely
available for Windows, Mac, and Linux computers. There is also a browser-based
version of the software.
Resources
This book is supported by an accompanying web page.
www.arduinobook.com
There you will find all the source code used in this book as well as other resources,
such as errata.
Microcontrollers
The heart of your Arduino is a microcontroller. Pretty much everything else on
the board is concerned with providing the board with power and allowing it to
communicate with your desktop computer.
A microcontroller really is a little computer on a chip. It has everything and
more than the first home computers had. It has a processor, a small amount of
random access memory (RAM) for holding data, some erasable programmable
read-only memory (EPROM) or flash memory for holding your programs and it
has input and output pins. These input/output (I/O) pins link the microcontroller
to the rest of your electronics.
50
Index
A B C D E F G H I J K L M N O P Q R S T U V
W X Y Z
A
abrasion: 30
Adair, John: 6
“Age of Mammals”: 27
alabaster: 17
ancient man in Palo Duro Canyon: 3
anhydrite: 18
anticlines: 18
Apaches: 1, 3
aquifer: 26
Arapahos: 3
Archeozoic rocks: 13
B
“blow sand”: 28
bottom load: 29
Brazos River: 8
Buettneria: 22, 23, 24
C
calcite: 22
caliche: 26
camels: 27
camping and picnicking: 43
Canyon, Texas: 45
Capitol Peak: 1, 18, 19, 31, 40, 42
Carboniferous Period: 16
Catarina Cave: 19, 37, 38
chemical weathering: 30
chert: 26
Cheyennes: 3
Civilian Conservation Corps: 8
Colorado River: 8
comancheros: 6, 46
Comanches: 1, 3
concretions: 22
conglomerate: 24
coprolites: 22
Coronado, Francisco Vasquez de: 3
Coronado Lodge: 1, 21, 26, 33, 34
“Cow Cabins”: 41
cross-bedding: 19, 20
cross-stratification: 19
D
decomposition: 30
Devil’s Slide: 19, 40, 44
Devil’s Tombstone: 40
differential erosion: 31, 41
disintegration: 30
dugout, Col. Charles Goodnight’s: 39, 40
E
earth history: 10-12
Eastern Caprock Escarpment: 8
erosion, differential: 31, 41
F
flash floods: 29
fluorescence: 26
fluvial sediments: 24
Fortress Cliff: 1, 40, 42
fossils: 10
frost wedging: 30
G
geodes: 22
geologic column: 12
geologic time scale: 11, 12
geomorphologist: 29
Goodnight, Colonel Charles: 1, 39, 40
gypsum: 17
H
Harper, Mrs. Ples: 35
hematite: 22
Hester, W. A.: 1
High Plains: 8
hiking: 43
history of park: 3-8
“hoodoos”: 23, 31
Horn, Ron: 35
horseback riding: 43
horses: 27
hydration: 18, 31
hydraulic action: 30
I
Ice Age: 3
igneous rocks: 10
Indian campground: 39
Indians of the Plains: 3
J
JA Ranch: 6
K
Kiowas: 1, 3
L
Lighthouse, The: 23, 25, 39, 41
Little Sunday Canyon: 39
Llano Estacado: 8
M
Mackenzie, Colonel Ranald: 3
mammals: 27
Marcy, Captain R. B.: 6
mass-wasting: 31
mastodon, shovel-jawed: 27
mechanical weathering: 30
metamorphic rocks: 10
mortar hole: 25
O
Observation Point: 33
Ogallala Formation: 21, 23-27, 42
opal: 26
oxidation: 31
P
Paleozoic Era: 13
Palo Duro Canyon State Park: 7, 14, 45
Panhandle-Plains Historical Museum: 2, 27, 45-46
Park Entrance: 33
park history: 3-8
Park Road 5: 33, 38, 50
Parker, Chief Quanah: 7
Pecos River: 8 51
pedestal rock: 25
petrified wood: 22
photography: 43
phytosaurs: 22
picnicking and camping: 43
Pioneer Amphitheatre: 33-34
Plains Indians: 3
Pleistocene rocks: 28
time: 3
Pliocene Epoch: 27
Prairie Dog Town Fork of the Red River: 1, 29, 39
Precambrian rocks: 13
principle of superposition: 13
Proterozoic rocks: 13
psilomelane: 22
Q
Quartermaster Formation: 12, 17-19, 20, 21, 31, 36, 37, 42, 44
R
Red River: 8, 29
reduction halos: 19, 20
ripple marks: 19
Rock Garden, The: 23, 40, 43
Rocky Mountains: 24
S
saber-tooth cat: 27
Sad Monkey, Texas: 36
Railroad: 6, 20, 23, 35
Santana’s Face: 23, 37, 38
satin spar: 17
Scenic Drive, The: 33
sedimentary rocks: 10
sediments: 10
selenite: 17
septaria: 22
septarian concretions: 22
shovel-jawed mastodon: 27
Sky Ride, The: 37
Sleeping Indian: 40, 42
sloths: 27
siliceous rocks: 27
solution: 29
Spanish Skirts: 19, 37
suffosian: 19
Sunday Canyon: 40
superposition, principle of: 13
suspension: 29
synclines: 18
T
talus: 31
talus slopes: 31
Tecovas Formation: 19-22, 36, 37, 42, 44
Texas Panhandle: 9
Texas Panhandle Heritage Foundation, Inc.: 35
Texas Parks and Wildlife Department: 2
Texas-Santa Fe Expedition: 6
Timber Mesa: 1, 23, 37, 38
time scale, geologic: 11, 12
tortoises: 27
Triassic Peak: 1, 35
Trujillo Formation: 20, 21, 22-23, 36, 38, 42, 43
Turnaround, The: 1, 41, 44
U
unconformities: 21
W
water crossings: 39
weathering: 30
West Texas State University: 45
Wolfin, Charles A.: 1
Footnotes
[1]
Professor of Geology, Lamar State College of Technology,
Beaumont, Texas.
[2]
Entries marked with asterisk are published by the Bureau of
Economic Geology, The University of Texas at Austin. Those not
out of print are distributed at nominal sale price; list sent on
request.
Transcriber’s Notes
This book, published without copyright notice, is in the public
domain.
Silently corrected a few palpable typos.
Added links to glossary entries.
*** END OF THE PROJECT GUTENBERG EBOOK THE GEOLOGIC
STORY OF PALO DURO CANYON ***
Updated editions will replace the previous one—the old editions will
be renamed.
1.D. The copyright laws of the place where you are located also
govern what you can do with this work. Copyright laws in most
countries are in a constant state of change. If you are outside the
United States, check the laws of your country in addition to the
terms of this agreement before downloading, copying, displaying,
performing, distributing or creating derivative works based on this
work or any other Project Gutenberg™ work. The Foundation makes
no representations concerning the copyright status of any work in
any country other than the United States.
1.E.6. You may convert to and distribute this work in any binary,
compressed, marked up, nonproprietary or proprietary form,
including any word processing or hypertext form. However, if you
provide access to or distribute copies of a Project Gutenberg™ work
in a format other than “Plain Vanilla ASCII” or other format used in
the official version posted on the official Project Gutenberg™ website
(www.gutenberg.org), you must, at no additional cost, fee or
expense to the user, provide a copy, a means of exporting a copy, or
a means of obtaining a copy upon request, of the work in its original
“Plain Vanilla ASCII” or other form. Any alternate format must
include the full Project Gutenberg™ License as specified in
paragraph 1.E.1.
• You pay a royalty fee of 20% of the gross profits you derive
from the use of Project Gutenberg™ works calculated using the
method you already use to calculate your applicable taxes. The
fee is owed to the owner of the Project Gutenberg™ trademark,
but he has agreed to donate royalties under this paragraph to
the Project Gutenberg Literary Archive Foundation. Royalty
payments must be paid within 60 days following each date on
which you prepare (or are legally required to prepare) your
periodic tax returns. Royalty payments should be clearly marked
as such and sent to the Project Gutenberg Literary Archive
Foundation at the address specified in Section 4, “Information
about donations to the Project Gutenberg Literary Archive
Foundation.”
• You comply with all other terms of this agreement for free
distribution of Project Gutenberg™ works.
1.F.
1.F.4. Except for the limited right of replacement or refund set forth
in paragraph 1.F.3, this work is provided to you ‘AS-IS’, WITH NO
OTHER WARRANTIES OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO WARRANTIES OF
MERCHANTABILITY OR FITNESS FOR ANY PURPOSE.
Please check the Project Gutenberg web pages for current donation
methods and addresses. Donations are accepted in a number of
other ways including checks, online payments and credit card
donations. To donate, please visit: www.gutenberg.org/donate.
Most people start at our website which has the main PG search
facility: www.gutenberg.org.
ebookmasss.com