EasyManuals Logo

Arduino uno User Manual

Arduino uno
311 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #215 background imageLoading...
Page #215 background image
First we include all of the libraries we need, and we define constants for the
PIR sensor pin and our MAC address. Then we define
SmtpService
and
PassiveIn-
fraredSensor
objects and use them to define a
BurglarAlarm
instance. Note that we
pass a username and a password, implying that were using an authenticated
SMTP connection to send our emails. If you use an unauthenticated connec-
tion, you can safely remove the
USERNAME
and
PASSWORD
parameters and all of
their occurrences.
In the
setup
method, we define the serial port and the Ethernet shield. Ive
also added a delay of twenty seconds, which gives you enough time to leave
the room before the alarm begins to work.
The
loop
function is simple, too. It delegates all the work to
BurglarAlarm
s
check
method. In the following figure, you can see what happens when the burglar
alarm detects an intruder.
Did you notice how easy object-oriented programming on an embedded device
can be? Weve cleanly hidden in two small classes the complexity of both
email and the PIR sensor. To build the burglar alarm, we then only had to
write some glue code.
One word regarding privacy: do not abuse the project in this chapter to observe
other people without their knowledge. Not only is it unethical, but in many
countries its even illegal!
In this and the preceding chapter, you learned different ways to connect the
Arduino to the Internet. Some of them require an additional PC, while others
need an Ethernet shield, but they all open the door to a whole new range of
embedded computing applications.
report erratum discuss
Bringing It All Together 199
www.it-ebooks.info

Table of Contents

Other manuals for Arduino uno

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Arduino uno and is the answer not in the manual?

Arduino uno Specifications

General IconGeneral
Form factorArduino
CertificationRoHS, FC, CE
Processor model-
Processor frequency- MHz
Microcontroller modelATmega328
Microcontroller frequency16 MHz
DC input voltage7-12 V
Operating voltage5 V
DC current per I/O pin40 mA
Flash memory0.032 MB
Maximum internal memory- GB
SRAM (Static Random Access Memory)2 KB
EEPROM (Electrically Erasable Programmable Read-Only Memory)1 KB
Wi-FiNo
Number of analog I/O pins6
Number of digital I/O pins14
Weight and Dimensions IconWeight and Dimensions
Board dimensions53.4 x 68.6 mm

Related product manuals